最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

custom post types - Change the WordPress database prefix on the fly?

programmeradmin1浏览0评论

I have a multisite setup and hope to have one site host all the data for a particular CPT. That data would then be used by the other sites without having to duplicate it. My thought is to change the prefix before the query if it is for a certain CPT, and restore it after the query.

  1. If you have a better idea I'd love to hear it.
  2. How could I go about doing this? I found the pre_get_posts hook. But it seems the db query is already setup. Can I change the target table in the query? Also, I haven't found an equivalent hook after the query to restore the prefix.

Any thoughts?

发布评论

评论列表(0)

  1. 暂无评论