WordPress.org

Ready to get started?Download WordPress

Forums

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

  1. bobbydonovan
    Member
    Posted 1 year 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 );
    to
    $p = wp_insert_post( apply_filters('sitewide_tags_post_insert', $post) );

    Keep up the good work.

    http://wordpress.org/extend/plugins/wordpress-mu-sitewide-tags/

  2. bobbydonovan
    Member
    Posted 1 year 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
    Member
    Posted 1 year 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

About this Topic

Tags

No tags yet.