I have Two domain for e.g

example.com (Database prefix wpone_)

demo.example.com (Database prefix wptwo_)

Database name: myrestaurant

Database is the same for two domain just only prefix different

I have one custom post type called restaurants.

Question: When i will post any restaurants in subdomain that entry i want in wpone_posts table( Means main domain table not in subdomain wptwo_posts table)

So here how to change database table prefix wptwo_ to wpone_ when wp_insert_post query execute?

Please give suggestion how to can i do?

Anyone have idea? Please do not down this question. Thanks

  • say it is only for inserting and it is possible, what happens when you go to retrieve the posts? they will not be editable / visible / available from the subdomain site. – majick Apr 27 '18 at 9:05
  • You cannot simply change the table prefix to achieve what you want. If you want to add restaurant from custom form or frontend you can make post request to main domain example.com. – Bikash Waiba Apr 27 '18 at 9:20

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.