Comments (18)
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.
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.
Good idea. I'll throw up a quick PR to get the can rolling around.
from jetpack.
Fix tidied up in 8ed18b1
from jetpack.
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.
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.
Using wpas_submit_post? filter to mark a post not to be Publicized wasn't working.
Fixed here: 2beb14c
from jetpack.
Reopening since 2beb14c was reverted in e34c644
from jetpack.
Also requested here:
https://wordpress.org/support/topic/disable-publicize-by-category?replies=1&view=all
from jetpack.
Also reported here:
https://wordpress.org/support/topic/wpas_submit_post-hook
from jetpack.
Also requested here: 2225022-t
from jetpack.
Also requested here:
https://wordpress.org/support/topic/publicize-is-sharing-on-other-post-types
from jetpack.
Also requested here:
https://twitter.com/occasio/status/631158437905235968
from jetpack.
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.
Also reported here:
https://wordpress.org/support/topic/can-publicize-publish-only-certain-categories?replies=1&view=all
from jetpack.
Also suggested here:
https://wordpress.org/support/topic/only-publish-some-category-publisize?replies=1&view=all#post-8105298
from jetpack.
Also requested here:
https://wordpress.org/support/topic/publicize-actions-to-use-along-with-wp_insert_post?replies=5
from jetpack.
@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)
- Boost: if page setup error is dismissed and module is enabled, settings aren't visible HOT 2
- WPCOM API / stats: stats/visits endpoint doesn't return views and visitors if last day of the month is passed as a parameter HOT 1
- Top Posts block: posts with same stat count ordered randomly HOT 2
- Payments: create path to migrate subscribers into WooCommerce Subscriptions HOT 1
- Voice to Content: Clear empty paragraph when transcription is done
- Blog Stats block: not working for simple wpcom sites HOT 5
- [Super Cache] Clean up the recommended links
- [Boost] Instead of garbage collection of cache data, refresh it
- Voice to Content: transcription does not work on iOS
- Voice to Content: upload button not respecting the accept property on iOS
- [Boost] Upload documentation to Jetpack.com/support HOT 2
- [Boost] Update all "read more" links
- Jetpack connection error banner requires account re-log in HOT 23
- Boost: Cache should clear on module setting changes HOT 3
- [Super Cache] refresh pages rather than delete when doing garbage collection
- WP 6.5 compat: unification of the site and post editors
- Top Bar Refinements: Remove gradient and text shadow from debug button HOT 6
- Top Bar Refinements: Convert “Proxied” banner to button HOT 7
- Top Bar Refinements: Reduce size of help icon HOT 1
- Top Bar Refinements: Update the notification icon
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from jetpack.