• Hi there! I’m somewhat new to WordPress and I’ve been digging hard into WP coding as of late.

    I’m currently writing a Plugin for handling a specific Custom Post Type (saving meta data, displaying it when appropriate, ad-hoc widget, and the like).

    I’m having trouble finding any reference about how to implemente exactly what I’m trying to do. I tryed searching the forums, the codex and on google, but wasn’t able to find an exact match. So sorry if I’m asking something old, feel free to point me to an appropriate topic, article, or already existing plugin if you know about any.

    What I’m asking for is general advice on how to specifically code the functionality I need: what functions I might want to use, how to make it work and the like. Not asking for extra-detailed code, just useful tips and your opinions about how to do it best, maybe some usefull code-snippet, but not much more. I know about switch_to_blog() and restore_current_blog() already.

    For the sake of clarity. “MY-CPT” refers to the specific custom post type my Plugin is intended to manage, “MAIN-SITE” refers to the root blog (ie example.com), “SUB-SITE” refers to any other blog in the network (ie blogname.example.com).

    Here’s what I’d like my Plugin to achieve:

    1 – When an admin for any blog (be it the MAIN-SITE or any SUB-SITE) opens up the Dashboard for posts of type MY-CPT, the table to be queried shall be that of the MAIN-SITE.
    2 – When an admin for any SUB-SITE creates a new post of type MY-CPT, it shall be saved/stored (meta-data included) into the MAIN-SITE’s tables.
    3 – An admin for any SUB-SITE shall be able to edit posts of type MY-CPT only-if the said post originated from the according SUB-SITE (using a custom field to store the blog-id maybe?).
    4 – An admin for any SUB-SITE shall be able to mark any post of type CPT and have the said post be showed on the according SUB-SITE (by pulling it from the MAIN-SITE’s db-tables).

    My main concern is: how do I hack WP’s admin-area related code, in order for it to pull/save posts from/into another blog (the MAIN-SITE’s)?

    I’d like to avoid having to code custom admin pages to achieve that, but hack the standard dashboard to get the intended behaveour working (for posts of type MY-CPT only!).

    Thanks in advance to everyone for helping out.

  • The topic ‘Multisite: saving a given CPT entries into a specific blog’ is closed to new replies.