Auto Draft in menu isn't disappearing

Hello,

I'm trying to get rid of the "Auto Draft" in the menu of our new site. I've watched your video (link below). Theme Editor isn't available, so I downloaded a plugin to put the code (below) in the Theme Functions, but "Auto Draft" is still in the menu.

Thanks. JL

https://www.youtube.com/watch?v=-qEI5ZFO3VU


/**

* Hide Draft Pages from the menu

*/

function filter_draft_pages_from_menu ($items, $args) {

 foreach ($items as $ix => $obj) {

 if (!is_user_logged_in () && 'draft' == get_post_status ($obj->object_id)) {

  unset ($items[$ix]);

 }

 }

 return $items;

}

add_filter ('wp_nav_menu_objects', 'filter_draft_pages_from_menu', 10, 2);

«134

Comments

Sign In or Register to comment.