Jetpack Publicize only certain categories

Unfortunately, Jetpack Publicize module don’t have the option to choose which category of posts you want to publicize automatically. Here is the quick hack to publicize module file in order to publish future posts only from chosen category.

add_filter('wpas_submit_post?', 'vipx_wpas_submit_post', 10, 4);
function vipx_wpas_submit_post($ret, $post_id, $name, $connection) {
 $categories = get_the_terms($post_id, 'category');
 if (is_array($categories)) {
 $categories = wp_list_pluck($categories, 'slug');
 if (empty($categories)) {
 if (in_array('SLUG-OF-YOUR-CATEGORY', $categories)) {
 $ret = false;
 return $ret;

Simply add this code after

class Publicize extends Publicize_Base {
function __construct() {

by editing wp-content/plugins/jetpack/modules/publicize/publicize-jetpack.php file


You can put several categories followed by slug from which you want to push posts to social networks.

Additionally you can publicize your posts to twitter with adding automatically hashtags from tags by installing Publicize With Hashtags plugin

, , ,
Next Post
How to get JSON data for popular posts from certain category on WordPress

Leave a Reply

Your email address will not be published. Required fields are marked *

Fill out this field
Fill out this field
Please enter a valid email address.


Jetpack Publicize only certain categories

by Adi Glibanović time to read: 1 min