Social Publisher : select what post type to publish on FB Timeline (5 posts)

  1. 2046
    Posted 2 years ago #


    is there any plan, or feature already, that lets us select what post type the Social publisher is allowed to share on FB timeline?


  2. alpha1beta
    Posted 2 years ago #

    There really should be a list, instead of checking that the post type is public. Co-authors-Plus breaks and posts non-public links. The Metaboxes cannot be removed either.

    Please redo how post types are handles, let the user choose.

  3. creativeworldstudio
    Posted 2 years ago #

    This feature is much needed. Please let us select the post_type that social publisher shares to Facebook

  4. wishie
    Posted 1 year ago #

    I too want this feature. Please add it.

  5. Christian Wach
    Posted 1 year ago #

    This is far from the ideal way to achieve this (Note to plugin authors: please give us a UI, or at least some filters!) but it looks like there is a way to override what this plugin does by setting a post meta value before the plugin has a chance to post to Facebook.

    function short_circuit_facebook_plugin( $post_id ) {
    	// get post type and sanity check
    	$post_type = get_post_type( $post_id );
    	if ( ! $post_type ) return;
    	// define post types you're concerned with
    	$post_types = array( 'some_post_type', 'other_post_type' );
    	// allow only your post types to be posted to Facebook
    	if ( in_array( $post_type, $post_types ) ) return;
    	// The Facebook plugin sets this once a post has been sent to the FB Page
    	// so setting a fake value will prevent it from posting. As a bonus, setting
    	// the value to '0' should prevent the Facebook plugin from trying to delete
    	// non-existent Facebook posts if this post is deleted
    	update_post_meta( $post_id, 'fb_fan_page_post_id', '0' );
    add_action( 'save_post', 'short_circuit_facebook_plugin', 10, 1 );

    If you also want to remove the meta boxes from the admin screens, you'll have to use something like the following:

    function filter_facebook_plugin_metabox_by_post_type() {
    	// sanity check
    	if ( ! is_admin() ) return;
    	// define post types you're concerned with
    	$post_types = array( 'some_post_type', 'other_post_type' );
    	// allow only your post types to show a Facebook metabox
    	$screen = get_current_screen();
    	if ( in_array( $screen->post_type, $post_types ) ) return;
    	// cancel meta box hooks
    	foreach( array( 'post', 'post-new' ) as $hook ) {
    		remove_action( 'load-' . $hook . '.php', array( 'Facebook_Social_Publisher', 'load' ), 1 );
    add_action( 'current_screen', 'filter_facebook_plugin_metabox_by_post_type' );

    Disclaimer: this code works for me but might not for you. It is also likely to break if the plugin authors introduce a UI for this.

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Facebook
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic