• Resolved apessoa

    (@apessoa)


    Hi
    Jetpack is really a great set of plugins. Kudos for that.

    I have a scenario for which I need some help.

    Some customers post articles in their blogs and publicize automagically posts them to their facebook pages.

    But most customers prefer posting on their facebook pages themselves for not having to use the wordpress site backend.
    Thus we implemented a RSS-to-post from their facebook pages to a category in their blog.
    That way, no matter where they post originally, it goes to both pages.

    But, the issue is when the use both the site and facebook to create new posts, and we have to use both publicize and rss-to-post.
    No matter where the article is originally created, it gets republised to the other platform and then republished again to the first one, and then again, and again.
    For example, when they create any new article on the blog, it get’s republished to facebook by publicize, and then reposted in their blog by the rrs-to-post, and then again publicize sends it to facebook, and then… you get the idea, an infinite loop of repeated posts both on the website and on the facebook page.

    I can force the rss-to-post to make articles belong to a certain category and prevent authors to to use it for new posts.
    Is there a way of disabling publicize just for that category, leaving it enabled and automatically republishing in the other categories?

    Thanks in advance and best regards,
    Alex

    https://www.ads-software.com/plugins/jetpack/

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Jeremy Herve

    (@jeherve)

    Jetpack Mechanic ??

    Is there a way of disabling publicize just for that category, leaving it enabled and automatically republishing in the other categories?

    I’m afraid that’s not possible at the moment. That’s on our roadmap though, and I’ll post again here as soon as it becomes possible.

    You can, however, stop your rss-to-post plugin from triggering Publicize by adding define( 'WP_IMPORTING', true ); to your code.

    Publicize will ignore all imported posts, so that would stop that infinite loop.

    I hope this helps.

    Thread Starter apessoa

    (@apessoa)

    Hi Jereny

    Thanks for the prompt reply.

    I’m not the developer of the plugin, so fiddling with the code is a bit beyond what I can achieve.
    I know that some filters and actions can be called in functions.php (or a funcionality plugin), but really can’t build them based on this.

    For now I found a halfway solution:
    – when importing from RSS I add a “stopword” to each post, and then tell the rss-to-post to never import posts with that word.
    – that way, if the post in facebook doesnt have that word (menaning, it was originally created there or is the first time it’s republished by publicize), it will be imported to the blog, and the stopword added.
    – it will then be published by publicize in facebook, but since the stopword is there, not again imported to the blog.

    the facebook wall will have a duplicate (with the added stopword) but not the blog.
    It’s not perfect, but for now stops the infinite loop.

    I’ll be waiting the the publicize category feature, that will make this a full solution.

    Thanks again for your help

    Plugin Author Jeremy Herve

    (@jeherve)

    Jetpack Mechanic ??

    Hi,

    I just wanted to come back to this thread, with some good news! As of the next major Jetpack release, 4.1, you’ll be able to exclude some posts from Publicize thanks to the publicize_should_publicize_published_post filter.

    Here is how you could use it:

    /**
     * Do not trigger Publicize if the post uses the <code>private</code> tag.
     */
    function jeherve_control_publicize( $should_publicize, $post ) {
        // Return early if we don't have a post yet (it hasn't been saved as a draft)
        if ( ! $post ) {
            return $should_publicize;
        }
    
        // Get list of tags for our post.
        $tags = wp_get_post_tags( $post->ID );
    
        // Loop though all tags, and return false if the tag's name is <code>private</code>
        foreach ( $tags as $tag ) {
            if ( 'private' == $tag->name ) {
                return false;
            }
        }
    
        return $should_publicize;
    }
    add_filter( 'publicize_should_publicize_published_post', 'jeherve_control_publicize', 10, 2 );

    Wow good timing Jeremy, thanks for all your hard work this has been several years in the making.

    Is there a way to only publicize certain categories in this next release? When is the targeted release data?

    Plugin Author Jeremy Herve

    (@jeherve)

    Jetpack Mechanic ??

    Is there a way to only publicize certain categories in this next release?

    You can use the same filter, publicize_should_publicize_published_post, but loop through categories instead of looking at tags like I did in the example above.

    When is the targeted release data?

    We do not have an ETA yet, but if you’d like you can join our Beta group here, install the Beta plugin, and be notified as soon as the next version of Jetpack is available for testing.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘disable publicize by category’ is closed to new replies.