Digital Boom
  • Home
  • News
  • Startups
  • Marketing
    • Digital Advertising
    • Insights
    • Social Media
  • Campaigns
  • Tech
  • Guides
  • More
    • Market Watch
    • Careers
    • Ramadan Specials
    • Culture
    • Travel
    • Glossary
    • Apple Updates
    • Facebook Marketing Hub
    • Markets
No Result
View All Result
  • Home
  • News
  • Startups
  • Marketing
    • Digital Advertising
    • Insights
    • Social Media
  • Campaigns
  • Tech
  • Guides
  • More
    • Market Watch
    • Careers
    • Ramadan Specials
    • Culture
    • Travel
    • Glossary
    • Apple Updates
    • Facebook Marketing Hub
    • Markets
No Result
View All Result
Digital Boom
No Result
View All Result
Home Guides

How to include search results from pages in WordPress?

by Ahmed Maher
August 28, 2022
How to include search results from pages in Wordpress?

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.

ShareTweetPin

Join Our Community

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.

Related Stories

How to deactivate or delete your Snapchat account?
Guides

Delete Snapchat Account (Step-by-Step 2025)

1 month ago
How to delete your TikTok account
Guides

Delete TikTok Account Permanently (2025 Guide)

1 month ago
How to recover your hacked Facebook account?
Guides

Recover Your Hacked Facebook Account

1 month ago
How to Copy and paste between devices from your Mac/iPhone
Guides

Enable Copy and Paste Between Apple Devices

2 months ago
How to Become LLM-Ready in 2025: A Guide for Publishers
Guides

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

2 months ago
How to include current URL in a Webflow form?
Guides

Include current CMS item URL in Webflow forms

2 years ago

Don't Miss

YouTube Tightens Monetization Rules on AI-Generated Content

YouTube Tightens Monetization Rules on AI-Generated Content

July 10, 2025
Amr Diab’s 2025 Album: Orange Sponsorship, Apple Music Comeback

Amr Diab’s 2025 Album: Orange Sponsorship, Apple Music Comeback

July 3, 2025 - Updated on July 5, 2025
Germany Begins Government-Wide Exit from Microsoft Software

Germany Begins Government-Wide Exit from Microsoft Software

June 14, 2025
Builder.ai Ceases Operations After $1.3 Billion Valuation Collapse

Builder.ai Shuts Down After Layoffs and Investor Pullout

May 26, 2025 - Updated on July 5, 2025
Jordan’s U.S. Foreign Aid: 2025 Budget Cuts and Their Regional Impact

Jordan’s U.S. Foreign Aid: 2025 Budget Cuts and Their Regional Impact

March 20, 2025
  • Digital Boom
  • About Us
  • Team
  • Partners
  • Submit an Article
  • Contact Us
  • Privacy Policy
  • Terms of Use

© 2025 Digital Boom, Inc.

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
  • Home
  • News
  • Startups
  • Marketing
    • Digital Advertising
    • Insights
    • Social Media
  • Campaigns
  • Tech
  • Guides
  • More
    • Market Watch
    • Careers
    • Ramadan Specials
    • Culture
    • Travel
    • Glossary
    • Apple Updates
    • Facebook Marketing Hub
    • Markets

© 2025 Digital Boom, Inc.