WordPress.org

Forums

[resolved] How to hide a page from the all pages list in dashboard (4 posts)

  1. matthewpolld
    Member
    Posted 7 months ago #

    Hello,

    My 'home' page is being used by the events manager plugin to display a list of events. So I don't want a user to try and add text to this page, by clicking 'edit' page. How can I either hide this page from the 'all pages' list or disable it in some way. I still want the page, as it's needed for the plugin.

    Thank-you.

  2. Mike Price
    WP Engine Tech Support
    Posted 7 months ago #

    Hey there,

    I found a couple of plugins that might help. The first one is free but doesn't really stop people from adding/editing text content. The 2nd one does exactly what you need but is $19 one time fee. Dont be confused that it says lock posts as it DOES lock pages as well (just tested it) Hopefully, one of these will work for what you need:

    https://wordpress.org/plugins/lock-pages/

    https://premium.wpmudev.org/project/lock-posts/

  3. matthewpolld
    Member
    Posted 7 months ago #

    Thank-you. I didn't really want to use another plugin for my site. I used this :

    add_filter( 'parse_query', 'exclude_pages_from_admin' );
    function exclude_pages_from_admin($query) {
        global $pagenow,$post_type;
        if (is_admin() && $pagenow=='edit.php' && $post_type =='page') {
            $query->query_vars['post__not_in'] = array('28');
        }
    }
  4. Mike Price
    WP Engine Tech Support
    Posted 7 months ago #

    Very cool! I am by no means a coder so this is over my head so I really appreciate plugins LOL Glad you were able to find the right code :)

Reply

You must log in to post.

About this Topic

Tags