Viewing 5 replies - 1 through 5 (of 5 total)
  • Hi @mighty2003,
    Yes if the page is not published then the page stays in the draft and is not visible in the menu and you can change the status of a page from published to draft by editing the page and clicking on the switch to draft option on the top right corner.

    However, if you do not want to display any page on the menu even if the page is published you can edit your menu by going into your WP Dashboard -> Customizer -> Menus and edit the menu you want.

    Thread Starter mighty2003

    (@mighty2003)

    Hi Sakar
    That’s not what I mean, when I switch a published page to draft, it remains visible in the menu. That’s my problem. The page should not be visible in the menu if it is only set to draft.
    That’s my site, where you see the problem.
    https://familietraeff.haas-strahm.ch/index.php/portrait-ferienpass/kurse/
    I set the page Kurse to draft an then i see this… “Diese Seite konnte leider nicht gefunden werden.” (Unfortunately this page could not be found.)
    You find this menu entry under “Ferienpass” -> “Angebot” -> “Kurse”.

    Hi @mighty2003,
    Yes I did get what you meant, but even when you switch published page to draft, it remains visible in the menu is according to WordPress’s function itself, it is not due to a problem on the theme. So if you wanna remove any page from the menu you can remove it by going into your WP Dashboard -> Customizer -> Menus and edit the menu you want.

    Thank you.

    Thread Starter mighty2003

    (@mighty2003)

    Hi @sakarrr
    It’s not a WP problem, the solution is on that page i linked in my first post, but i need this in the theme, because when i do it in the theme by myself, then i’ll lose it on every update and that’s not what i’m looking for…

    Her the text translated…
    Try in function.php, where the menu is created, to add the following to the array:

    PHP:

    ‘post_status’ => ‘publish’,

    That should actually work. Here are a few more links on the subject:
    http://codex.wordpress.org/Function_Reference/wp_nav_menu http://codex.wordpress.org/Function_Reference/wp_get_nav_menu_items

    Thread Starter mighty2003

    (@mighty2003)

    at least, after much search i found a solution.
    just need the right plugin –> Hide Drafts in Menus

    so, i’m sorry that i thought, it would be a problem of the theme. it was one of WP itself… but fixed easily with the plugin.

    Thanks Matthias

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Hide Menu Entry, when Site is set to draft’ is closed to new replies.