[wp-trac] [WordPress Trac] #36579: global $wp_rewrite not set when create_initial_post_types() first run

WordPress Trac noreply at wordpress.org
Tue Apr 19 09:12:11 UTC 2016


#36579: global $wp_rewrite not set when create_initial_post_types() first run
-------------------------------+------------------------------
 Reporter:  bobbingwide        |       Owner:
     Type:  enhancement        |      Status:  new
 Priority:  normal             |   Milestone:  Awaiting Review
Component:  Posts, Post Types  |     Version:  4.4
 Severity:  normal             |  Resolution:
 Keywords:                     |     Focuses:
-------------------------------+------------------------------

Comment (by bobbingwide):

 In my case I discovered the problem because the plugin was network
 activated; and network activated plugins are loaded after MU plugins.

 I could wait for 'plugins_loaded' but it's probably safer to wait for
 'setup_theme', since $wp_rewrite should have been initialised by then.
 'after_setup_theme' is too late if it's the theme that's registering the
 post type I want to override.


 As an aside: What's the reason for the `@` preceding the comment
 `// @plugin authors: warning: these get registered again on the init
 hook.`

 So, follow on question. Should there be a comment in the docblock for
 'register_post_type_args' saying when it's safe to hook into this filter?
 Or will this TRAC suffice?

--
Ticket URL: <https://core.trac.wordpress.org/ticket/36579#comment:2>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list