2011-06-15, 05:58:54
This might come in handy for someone...
When writing my latest plugin I need a hook on the pages.php page, unfortunaltely there is only header and footer executed on that page. Hooking into "footer" meant my function were run on all backend pages.
This little snippet allows you only to run on the pages you want;
When writing my latest plugin I need a hook on the pages.php page, unfortunaltely there is only header and footer executed on that page. Hooking into "footer" meant my function were run on all backend pages.
This little snippet allows you only to run on the pages you want;
Code:
$bt = debug_backtrace();
$shift=count($bt) -1;
if (pathinfo_filename($bt[$shift]['file'])=="pages"){ // changes pages to the page your looking for.
add_action('footer','your_function',array());
}