Title: Excluding Pages
Last modified: April 12, 2023

---

# Excluding Pages

 *  Resolved [hank3rd](https://wordpress.org/support/users/hank3rd/)
 * (@hank3rd)
 * [3 years, 4 months ago](https://wordpress.org/support/topic/excluding-pages-20/)
 * I am looking to exclude certain pages from the search results. I know that the
   suppression is really for posts and categories, but pages do not have categories.
 * I was able to use the ID to exclude a page, but I would have to look up many 
   and would have to add any new pages in the future. I wonder if there is another
   way to accomplish what I need?
 * The page I need help with: _[[log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Fexcluding-pages-20%2F%3Foutput_format%3Dmd&locale=en_US)
   to see the link]_

Viewing 3 replies - 1 through 3 (of 3 total)

 *  Plugin Author [wpdreams](https://wordpress.org/support/users/wpdreams/)
 * (@wpdreams)
 * [3 years, 4 months ago](https://wordpress.org/support/topic/excluding-pages-20/#post-16652912)
 * Hi,
 * Well, probably the best and easiest way to get around this is by enabling categories
   for pages. After that the category exclusions will be applied for pages too.
 * To do that, you can either use a custom code:
 *     ```wp-block-code
       // Add the category taxonomy to the page object type
       function add_categories_to_pages() {
         register_taxonomy_for_object_type('category', 'page');
       }
   
       // Display categories for pages in WordPress admin
       add_action( 'init', 'add_categories_to_pages' );
       ```
   
 * ..or maybe even [this plugin](https://wordpress.org/plugins/create-and-assign-categories-for-pages/).
 * For the custom code, please check the [safe coding guidelines](https://knowledgebase.ajaxsearchpro.com/safe-coding-guideline).
   I would recommend using the custom code, as it leaves less overhead for this 
   one specific task.
 * All the best,
   Ernest
 *  Thread Starter [hank3rd](https://wordpress.org/support/users/hank3rd/)
 * (@hank3rd)
 * [3 years, 4 months ago](https://wordpress.org/support/topic/excluding-pages-20/#post-16666034)
 * I ended up using the code and it works great. Thank you!
 *  Plugin Author [wpdreams](https://wordpress.org/support/users/wpdreams/)
 * (@wpdreams)
 * [3 years, 4 months ago](https://wordpress.org/support/topic/excluding-pages-20/#post-16667838)
 * Sounds great 🙂
 * I will mark this topic as resolved then. Feel free to rate the plugin if you 
   like it, it is greatly appreciated!
 * All the best,
   Ernest

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Excluding Pages’ is closed to new replies.

 * ![](https://ps.w.org/ajax-search-lite/assets/icon-256x256.png?rev=3192672)
 * [Ajax Search Lite - Live Search & Filter](https://wordpress.org/plugins/ajax-search-lite/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/ajax-search-lite/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/ajax-search-lite/)
 * [Active Topics](https://wordpress.org/support/plugin/ajax-search-lite/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/ajax-search-lite/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/ajax-search-lite/reviews/)

 * 3 replies
 * 2 participants
 * Last reply from: [wpdreams](https://wordpress.org/support/users/wpdreams/)
 * Last activity: [3 years, 4 months ago](https://wordpress.org/support/topic/excluding-pages-20/#post-16667838)
 * Status: resolved