[resolved] Social for custom posts (8 posts)

  1. nijip
    Posted 4 years ago #


    I notice Social doesn't apply to custom post types.
    Is there a way to change this, it would be great to have this ability.



  2. Alex King
    Plugin Contributor

    Posted 4 years ago #

    use the social_broadcasting_enabled_post_types filter.

  3. erikeric
    Posted 3 years ago #

    How exactly do we enable this? I've found that line in the social.php file but I am not sure how to change it to enable custom post types. Do I just add another array() command to that line?

  4. erikeric
    Posted 3 years ago #

    Nevermind, figured it out. If anyone else wants to know:

    Go to the plugins page. Click the "Edit" link under Social's entry. Do a find-in-page search for "social_broadcasting_enabled" which will bring you to this line:

    return apply_filters('social_broadcasting_enabled_post_types', array('posts'));

    And then just change "posts" to whatever the name of your custom post types are. I was also able to add multiple post types to that function as well, such as:

    return apply_filters('social_broadcasting_enabled_post_types', array('posts','news'));

    The only difficulty might be finding out what your custom post types are actually named in the code.

  5. nijip
    Posted 3 years ago #

    Thanks, worked like a treat.
    For any one else out there the line of code to change is on line 664.

  6. Alex King
    Plugin Contributor

    Posted 3 years ago #

    Don't change the code, use the filter. The reason is is there is so you can make changes to functionality without changing the code (and having it break on upgrade, etc.) - just like WordPress core.


  7. greggo
    Posted 3 years ago #

    This filter seems to have been updated recently. It now reads:

    public static function broadcasting_enabled_post_types() {
    		return apply_filters('social_broadcasting_enabled_post_types', get_post_types(array(
    			'public' => true,
    			'hierarchical' => false

    This includes my custom post types, but I'm still not getting any comments shown on them. I also tried to just change it to the code listed above without any luck.

  8. greggo
    Posted 3 years ago #

    My bad...it turns out I just needed to uncheck and recheck the "Allow people to post comments on new articles" setting to get it rolling for the custom post types.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic