[wp-hackers] "This page" inconsistency

David Coppit david at coppit.org
Wed Apr 5 18:23:52 GMT 2006


For management pages of plugins, it's sufficient to give the filename
without a directory:

   /blog/wp-admin/edit.php?page=category-order-management.php&action=blah

(category-order-management.php is in plugins/category_order)

But for options pages, you need to give the directory as well:

   /blog/wp-admin/options-general.php?page=category-access/category-access-options.php

If you don't you get an error.


The former can be gotten using this in the plugin:

   $_SERVER['PHP_SELF'] . "?page=" . basename(__FILE__);

Whereas you need this for the latter:

   $page_only_uri = $_SERVER["REQUEST_URI"];
   $page_only_uri = preg_replace('/&.*/','',$page_only_uri);


Questions: Is the first non-directory method a feature or a bug? Is this
inconsistency a feature or a bug? Is there a "correct" way of getting the
current page?

Thanks,
David

_____________________________________________________________________
David Coppit                           david at coppit.org
The College of William and Mary        http://coppit.org/

"... frothy eloquence neither convinces nor satisfies me."
-- 1899, Willard D. Vandiver (D-MO)


More information about the wp-hackers mailing list