Title: Add a page programatically
Last modified: August 19, 2016

---

# Add a page programatically

 *  [charleyramm](https://wordpress.org/support/users/charleyramm/)
 * (@charleyramm)
 * [15 years, 1 month ago](https://wordpress.org/support/topic/add-a-page-programatically/)
 * Hi,
    I would like to define a page in my theme – to show a list of links. I would
   also like to hide it from the Admin > Pages menu. It should still appear in the
   wp_list_pages() though. Is there a way to do this?
 * pseudo code:
 *     ```
       wp_define_page(
         array(
           'title'='Links',
           'template'='page-links.tpl.php'
           'show_in_wpadmin'=FALSE))
       ```
   

Viewing 1 replies (of 1 total)

 *  Thread Starter [charleyramm](https://wordpress.org/support/users/charleyramm/)
 * (@charleyramm)
 * [15 years, 1 month ago](https://wordpress.org/support/topic/add-a-page-programatically/#post-2048206)
 * I have found an example that hides a page from the wp-admin > Pages menu, and
   added the page and set the template file manually.
 *     ```
       //Exclude pages from the wp-admin > Pages menu
       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('47');
           }
       }
       ```
   
 * [http://wordpress.stackexchange.com/questions/13528/hide-a-page-in-the-admin-end-without-a-plugin](http://wordpress.stackexchange.com/questions/13528/hide-a-page-in-the-admin-end-without-a-plugin)

Viewing 1 replies (of 1 total)

The topic ‘Add a page programatically’ is closed to new replies.

 * 1 reply
 * 1 participant
 * Last reply from: [charleyramm](https://wordpress.org/support/users/charleyramm/)
 * Last activity: [15 years, 1 month ago](https://wordpress.org/support/topic/add-a-page-programatically/#post-2048206)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
