• Resolved SeanBanksBliss

    (@seanbanksbliss)


    When I go to the quick editor for my posts there are two instances of the Post Type Switcher showing up. This started happening after I exported a custom post type from another installation (which was also using Post Type Switcher), and then I changed the post type to posts instead of their original CPT.

    I suspect the import/export created this some how, like maybe the database has two PTS tables or columns, or rows, or something — but I don’t know as I’m not very good with these things.

    What do you think might be causing it?
    How can I fix it and have just one post type switcher drop down in my Quick Editor?

Viewing 5 replies - 1 through 5 (of 5 total)
  • Thread Starter SeanBanksBliss

    (@seanbanksbliss)

    I’ve also detected 15! instances in the Quick Editor of the Post Type Switcher when looking at CPTs.

    Hi,

    There is JS code which append drop down to all class named “.inline-edit-col-right .inline-edit-col”. As class are not unique there are many plugins in WordPress which also uses “inline-edit-col-right” class to show their settings in quick edit section

    If we restrict it to 1 then this problem will not occur.

    Search for below line code in file ( plugins\post-type-switcher\assets\js\quickedit.js )

    $( '.inline-edit-row' ).not( '#bulk-edit' )
    		.find( '.inline-edit-col-right .inline-edit-col' )
    		.append(
    			$( '.inline-edit-row #pts_quick_edit' )
    		);
    

    Replace with this code

    $( '.inline-edit-row .inline-edit-col-right:first .inline-edit-col' )
    		.append(
    			$( '.inline-edit-row #pts_quick_edit' )
    		);
    
    Thread Starter SeanBanksBliss

    (@seanbanksbliss)

    And a further update from Naresh:

    Root cause is outdated plugin code.

    https://wordpress.stackexchange.com/questions/37262/custom-post-types-columns-strange-issue

    Here is the quick fix.

    Search for below line code in file ( plugins\post-type-switcher\post-type-switcher.php )

    add_action( 'manage_posts_columns',        array( $this, 'add_column'    ) );
    add_action( 'manage_posts_custom_column',  array( $this, 'manage_column' ), 10,  2 );
    

    Replace with this code

    
    $post_type_names = get_post_types( array(), 'names' );
    		foreach ( $post_type_names as $name ) {
    			add_filter( "manage_{$name}_posts_columns",        array( $this, "add_column"    ) );
    			add_action( "manage_{$name}_posts_custom_column",  array( $this, "manage_column" ), 10,  2 );
    		}
    
    Plugin Author John James Jacoby

    (@johnjamesjacoby)

    This is not fixed in 3.1.0 but will be in 3.1.1.

    Thanks, Naresh Vachhani, for the JS fix.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Two Instances in Quick Editor after Importing Custom Post Type’ is closed to new replies.