WordPress.org

Ready to get started?Download WordPress

Forums

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

  1. 2046
    Member
    Posted 11 months ago #

    Hello,

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

    http://wordpress.org/plugins/facebook/

  2. alpha1beta
    Member
    Posted 11 months 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
    Member
    Posted 10 months ago #

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

  4. wishie
    Member
    Posted 6 months ago #

    I too want this feature. Please add it.

  5. Christian Wach
    Member
    Posted 1 week 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.

Reply

You must log in to post.

About this Plugin

About this Topic