WordPress.org

Ready to get started?Download WordPress

Forums

WP Custom Admin Bar
Fix for notice about $ID (1 post)

  1. Liam Gladdy
    Member
    Posted 2 years ago #

    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

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.