GithubHelp home page GithubHelp logo

Comments (18)

jeherve avatar jeherve commented on May 28, 2024 2

Here is how one could use this new filter. In the example below, we won't publicize any post using the private tag:

/**
 * Do not trigger Publicize if the post uses the `private` 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 `private`
    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 );

from jetpack.

georgestephanis avatar georgestephanis commented on May 28, 2024

The first temporary fix would be to have the connections be non-global, which I know stops scheduled posts from publicizing.

Also, maybe have them define( 'WP_IMPORTING', true ); when it's checking -- which should stop it (I think), as well as other things like subscription notifications. Not 100% positive on that one, but I definitely agree that it's worth adding a filter to make it simpler if someone wants to disable publicizing on a category by category basis or other arbitrary data.

from jetpack.

kraftbj avatar kraftbj commented on May 28, 2024

Good idea. I'll throw up a quick PR to get the can rolling around.

from jetpack.

georgestephanis avatar georgestephanis commented on May 28, 2024

Fix tidied up in 8ed18b1

from jetpack.

georgestephanis avatar georgestephanis commented on May 28, 2024

Reverted both commits.

This could have been accomplished using the existing wpas_submit_post? filter later on. It's called more times, one per service, but can just return the same value for each.

from jetpack.

jeherve avatar jeherve commented on May 28, 2024

You can read more about that filter and find some applications of the filter here:
http://vip.wordpress.com/documentation/customizing-publicize-sharing-behavior/

from jetpack.

lezama avatar lezama commented on May 28, 2024

Using wpas_submit_post? filter to mark a post not to be Publicized wasn't working.
Fixed here: 2beb14c

@kraftbj @richardmtl

from jetpack.

jeherve avatar jeherve commented on May 28, 2024

Reopening since 2beb14c was reverted in e34c644

from jetpack.

jeherve avatar jeherve commented on May 28, 2024

Also requested here:
https://wordpress.org/support/topic/disable-publicize-by-category?replies=1&view=all

from jetpack.

jeherve avatar jeherve commented on May 28, 2024

Also reported here:
https://wordpress.org/support/topic/wpas_submit_post-hook

from jetpack.

mikeyarce avatar mikeyarce commented on May 28, 2024

Also requested here: 2225022-t

from jetpack.

jeherve avatar jeherve commented on May 28, 2024

Also requested here:
https://wordpress.org/support/topic/publicize-is-sharing-on-other-post-types

from jetpack.

jeherve avatar jeherve commented on May 28, 2024

Also requested here:
https://twitter.com/occasio/status/631158437905235968

from jetpack.

samhotchkiss avatar samhotchkiss commented on May 28, 2024

What we may want to do is add a post meta field that opts out of publicizing. This would require third-party plugins to create the post as a draft, set the meta, then publish.

Alternately, adding a filter that is checked on post creation that allows that meta to be added before it's sent onwards.

from jetpack.

jeherve avatar jeherve commented on May 28, 2024

Also reported here:
https://wordpress.org/support/topic/can-publicize-publish-only-certain-categories?replies=1&view=all

from jetpack.

jeherve avatar jeherve commented on May 28, 2024

Also suggested here:
https://wordpress.org/support/topic/only-publish-some-category-publisize?replies=1&view=all#post-8105298

from jetpack.

RCowles avatar RCowles commented on May 28, 2024

Also requested here:
https://wordpress.org/support/topic/publicize-actions-to-use-along-with-wp_insert_post?replies=5

from jetpack.

chrisaldrich avatar chrisaldrich commented on May 28, 2024

@kraftbj already responded, but for completeness: also suggested here: http://stream.boffosocko.com/2016/this-is-hopefully-a-simple-but-useful-feature-requesti-appreciate
(This also relates to jetpack_allow_per_post_subscriptions for email and alternate posting methods to WP including via email and micropub with clients like Quill

Glad to know that JetPack is on GitHub :)

from jetpack.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.