The Support Forums will be in read-only mode for a scheduled maintenance window on 01 September 2016 14:00 UTC - 20:00 UTC. More information.

Get post ID from permalink before wp_rewrite is loaded. (2 posts)

  1. Jeff Sterup
    Posted 5 years ago #

    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?

  2. Jeff Sterup
    Posted 5 years ago #

    Well I was not able to figure this out so i went a different way that is much more stable than my original attempt. The plugin is hosted at http://wordpress.org/extend/plugins/plugin-organizer/ if anyone wants to try it. If anyone could answer my original question I would appreciate it.

Topic Closed

This topic has been closed to new replies.

About this Topic


No tags yet.