• Partners
  • Privacy Policy
  • About us
  • Contact us
Thursday, May 29, 2025
  • Login
Digital Boom
  • News
  • Startups
  • Marketing
  • Ad Campaigns
  • Tech
  • How-to Guides
  • Insights
  • Culture & Media
No Result
View All Result
  • News
  • Startups
  • Marketing
  • Ad Campaigns
  • Tech
  • How-to Guides
  • Insights
  • Culture & Media
No Result
View All Result
Digital Boom
No Result
View All Result
Home Guides & Tutorials

How to include search results from pages in WordPress?

Ahmed Maher by Ahmed Maher
August 28, 2022
in Guides & Tutorials
Reading Time: 1 min read
10
A A
How to include search results from pages in Wordpress?
352
VIEWS

WordPress is an open-source CMS known for blogging and news websites, which relies on posts more than pages. The default search function returns results from posts only, but not from pages.

The WordPress search function will be useless for evergreen content websites as they are built using pages, not posts.

So how to make the WordPress search function return results from pages instead of posts?

Fortunately, there’s a solution for this without hiring a developer.

Simple, go to WordPress Dashboard -> Select Theme File Editor under Appearance -> from the right-hand sidebar, select Functions.php file – add the following code to the very end of the file -> Save.

Now, test your WP Search function. You will notice that search results do now return with results from pages.

 

function wpshock_search_filter( $query ) {
    if ( $query->is_search ) {
        $query->set( 'post_type', array('post','page') );
    }
    return $query;
}
add_filter('pre_get_posts','wpshock_search_filter');

Please drop us a line if you need any help.

Previous Post

Where to watch House of the Dragon online in MENA

Next Post

Netflix considers a new ad-supported plan

Ahmed Maher

Ahmed Maher

Ahmed Maher is a marketing and growth leader with a proven track record across telecom, fintech, publishing, charity, government, e-commerce, and sports. He launched Vodafone Egypt’s digital and social media presence in 2008, setting new standards for brand engagement and performance marketing in the region. As the founder of Digital Boom, Ahmed has helped shape the voice of digital media in the Arab world. He brings a rare blend of creative vision and data-driven thinking, using digital tools and storytelling to drive measurable impact and scalable growth.

Uber Launches Uber One in Egypt to Strengthen Customer Loyalty
Tech

Uber Launches Uber One in Egypt to Strengthen Customer Loyalty

by Ahmed Maher
May 27, 2025
0

Uber has officially launched its global subscription program, Uber One, in Egypt, offering ride-hailing users exclusive benefits such as ride...

Read moreDetails
Builder.ai Ceases Operations After $1.3 Billion Valuation Collapse

Builder.ai Shuts Down After Layoffs and Investor Pullout

May 28, 2025
How to Become LLM-Ready in 2025: A Guide for Publishers

Publishing for Machines: The 2025 Guide to LLM-Ready Content

May 26, 2025
Thndr Raises $15.7M to Expand into Wealth Management in MENA

Thndr Raises $15.7M to Expand into Wealth Management in MENA

May 26, 2025
Twitter History: Key Moments and Evolution from 2006 to Now

The History of Twitter: Key Milestones and Major Changes

May 23, 2025
  • Partners
  • Privacy Policy
  • About us
  • Contact us

© 2025 Digital Boom, Inc. - All Copyrights Reserved. The Middle Easy Marketing & Advertising Homepage.

Welcome Back!

Login to your account below

Forgotten Password?

Retrieve your password

Please enter your username or email address to reset your password.

Log In

Add New Playlist

No Result
View All Result
  • News
  • Startups
  • Marketing
  • Ad Campaigns
  • Tech
  • How-to Guides
  • Insights
  • Culture & Media

© 2025 Digital Boom, Inc. - All Copyrights Reserved. The Middle Easy Marketing & Advertising Homepage.