WordPress.org

Support

Support » Plugins and Hacks » WP Custom Admin Bar » [Plugin: WP Custom Admin Bar] Fix for notice about $ID

[Plugin: WP Custom Admin Bar] Fix for notice about $ID

  • When using heavily custom pages, get_queried_object()->ID might not be set, causing a PHP notice.

    The fix for this is to replace the block of code from line 66 > 70 of custom-admin-bar-functions.php with:

    $hidepage = isset($current_object->ID) ? "?cab_hide_page=".$current_object->ID : '';
    $wp_admin_bar->add_menu(
    	array(	'parent' => 'cab-menu',
    		'id' => 'cab_hide_page',
    		'title' => __( 'Hide For This Page' ),
    		'href' => parse_url($_SERVER['REQUEST_URI'],PHP_URL_PATH).$hidepage
  • The topic ‘[Plugin: WP Custom Admin Bar] Fix for notice about $ID’ is closed to new replies.
Skip to toolbar