WordPress.org

Ready to get started?Download WordPress

Forums

Akismet
Script loading every backend page; get_plugin_page_hook problem + solution (1 post)

  1. nextendweb
    Member
    Posted 1 year ago #

    get_plugin_page_hook give back null, if there is no active hook:

    function get_plugin_page_hook( $plugin_page, $parent_page ) {
    	$hook = get_plugin_page_hookname( $plugin_page, $parent_page );
    	if ( has_action($hook) )
    		return $hook;
    	else
    		return null;
    }

    In admin.php akismet calls this like:

    if ( function_exists( 'get_plugin_page_hook' ) )
            $hook = get_plugin_page_hook( 'akismet-stats-display', 'index.php' );
        else
            $hook = 'dashboard_page_akismet-stats-display';

    This is wrong, because the function will give back null and the scripts will be loaded on every page.
    Better solution could be check for null or the following code:

    if ( function_exists( 'get_plugin_page_hookname' ) )
            $hook = get_plugin_page_hookname( 'akismet-stats-display', 'index.php' );
        else
            $hook = 'dashboard_page_akismet-stats-display';

    http://wordpress.org/extend/plugins/akismet/

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.