0

I created a new table (named extrapage) in the wordpress database (named wpsite_db). I have added to this table some pages not published directly with wordpress and I want these pages to be considered when searching the site. But I don't know how to proceed. I did some research and learned that I would have to extend WP_query to my new table. But I'm a novice and I don't know how to proceed in real life.

Can someone help me, please? Thank you in advance.

  • Is this table an exact copy of wp_posts? Why are you using a custom table to begin with? How are you adding content to this table. – Jacob Peattie Jul 19 at 13:25
  • Hello @Jacob, In fact I created the wordpress site in a php site subfolder (I wanted the blog part to be wordpress). And so, when you search on the blog, the pages of the php site are naturally not considered. I have duplicated the wp_posts table and filled in manually to extend the search to this table. – Worksfather Jul 19 at 14:03
  • 1
    Have you considered using custom post types? – Tom J Nowell Jul 19 at 14:30
  • @TomJNowell How can I use post types if I want to include posts that are not published with wordpress? – Worksfather Jul 19 at 17:36
  • you would use custom post types instead of them, since we don't know anything about this other system, how it works, or how it stores its data it's super difficult to give advice, but, you can't just plumb new tables into WP_Query – Tom J Nowell Jul 19 at 17:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.