WordPress MU Sitewide Tags Pages
Hook on post insert (3 posts)

  1. bobbydonovan
    Posted 4 years ago #

    Hi there,

    Love the plugin, great job. I made a small customisation to suit my needs and thought you might like to include it in a future version. For example if the post already existed on the destination blog I wanted to maintain the post_status (draft etc) in order to allow a very basic level of moderation.

    Line 437 I changed from
    $p = wp_insert_post( $post );
    $p = wp_insert_post( apply_filters('sitewide_tags_post_insert', $post) );

    Keep up the good work.


  2. bobbydonovan
    Posted 4 years ago #

    Forgot to add, the other half of that example above is the function below, just in case someone wants it.

    add_action('sitewide_tags_post_insert', 'custom_save_publish_state');
    function custom_save_publish_state($post) {
        if ($post->ID) {
            $existing_post = get_post($post->ID);
            $post->post_status = $existing_post->post_status;
        return $post;
  3. werxes
    Posted 4 years ago #

    Can you help, I want to insert post only which in selected category.

    I tried to modify
    $p = wp_insert_post( $post );

    in to

    if (in_array("mycategory", $cats){

    $p = wp_insert_post( $post );

    not working

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • WordPress MU Sitewide Tags Pages
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic


No tags yet.