[wp-trac] [WordPress Trac] #21335: add_rewrite_endpoint() malfunction

WordPress Trac wp-trac at lists.automattic.com
Sat Jul 21 11:59:34 UTC 2012


#21335: add_rewrite_endpoint() malfunction
---------------------------+-----------------------------
 Reporter:  Fike           |      Owner:
     Type:  defect (bug)   |     Status:  new
 Priority:  normal         |  Milestone:  Awaiting Review
Component:  Rewrite Rules  |    Version:  3.4.1
 Severity:  minor          |   Keywords:
---------------------------+-----------------------------
 1. If add_rewrite_endpoint() is called just right from plugin file, it
 will result in standard PHP error, telling that $wp_rewrite isn't
 initialized yet (call to blahblahblah on a non-object). I guess there
 should be placed _doing_it_wrong() function explaining that
 add_rewrite_point should be called during 'init' action (it would be even
 better if add_rewrite_endpoint() would automatically store passed
 arguments until 'init' action and would tell developer that his callings
 are late if add_rewrite_point() is called after uri parsing - as for me,
 finding the right action during core interaction is VERY complicated).
 2. add_rewrite_endpoint() doesn't work on my localhost at all (404 is
 being returned without any additional query vars; i've tried adding
 endpoint 'json' to EP_ALL, EP_PAGES, EP_PERMALINKS, etc. and calling
 site/page/json and site/page/json/x), even if i just copy example code and
 declare new query var through 'query_vars' filter. Tried this on
 customized theme and on fresh install with twenty-eleven theme with no
 success.

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/21335>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list