Pages with no content can appear in search results. To address this issue, I used the ‘pre_get_posts’ function to exclude any ‘post’ with an empty ‘post_content’ field from the search query.
Here’s the code I used:
Pages with no content can appear in search results. To address this issue, I used the ‘pre_get_posts’ function to exclude any ‘post’ with an empty ‘post_content’ field from the search query.
Here’s the code I used:
Leave a Reply