WordPress.org

Support

Support » Plugins and Hacks » Hacks » Get post ID from permalink before wp_rewrite is loaded.

Get post ID from permalink before wp_rewrite is loaded.

  • I’m working on a plugin that lets you selectively disable plugins for each page. I have everything in place but I have some concerns with the way I had to do it. My plugin is loaded as a must use plugin so it loads befare all standard plugins and can disable them before they are loaded. Since the $wp_query, $wp_rewrite, and $wp objects have not been created yet there is no easy way to get the post id from the permalink of the current page. What I had to do was to create the $wp_query, $wp_rewrite, and $wp objects and use the url_to_postid() function. This doesnt seem like a good idea. Does anyone know a better way to accomplish this?

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Get post ID from permalink before wp_rewrite is loaded.’ is closed to new replies.