WordPress Page Tree
Menu exclude code excludes affected pages in Page Tree when it shouldn (1 post)

  1. SchuminWeb
    Posted 4 years ago #

    I am using Page Tree:


    To navigate the pages on my site in the backend of WordPress, and I have this code in my functions.php file:

    <?php add_filter('wp_list_pages_excludes','themename_exclude');
    function themename_exclude($output = '') {
    /* returns posts with a custom exclude tag so they don't display in the menus */
    $pages = get_all_page_ids();
    foreach ($pages as $pageid) {
    $is_excluded = get_post_custom_values("page_nav_exclude",$pageid);
    if ($is_excluded[0] == '1') {
    array_push($output, $pageid);
    return $output;

    The code in functions.php is there to allow one to exclude a page from menus and such via a custom field. I found the code here:


    However, the code also affects Page Tree when it shouldn't. If I exclude a page with a custom field, it also removes the page from Page Tree's list, when it shouldn't actually do that.

    I don't know if this is a bug in the plugin or something that I should be doing differently, but the current situation is obviously not all that helpful. Any insight into what is going on?

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic