• I have installed the plugin in order to be able to duplicate posts and pages, but it’s shown also on the products, although products (WooCommerce) has the duplicate functionality as native.

    How I can remove it from products and have it shown only on posts and pages?

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author metaphorcreations

    (@metaphorcreations)

    There isn’t any way to remove it at this point, but you can hide it using some custom css:

    .post-type-product .row-actions .duplicate_post {
      display: none;
    }
    rubybot

    (@rubybot)

    I came across this upon install too, I use Advanced Custom Fields and it too has a native ‘Duplicate’ action. I was able to exclude the Post Duplicator buttons/link by doing the following.

    
    function excludeDuplicatorAction($actions, $post){
    	
    	$postType = get_post_type();
    	if(in_array($postType , array('acf-field-group'))):
    		if(isset($actions['duplicate_post'])):
    			unset($actions['duplicate_post']);
    		endif;
    	endif;
    
    	return $actions;
    }
    add_filter( 'post_row_actions', 'excludeDuplicatorAction', 11, 2 );
    add_filter( 'page_row_actions', 'excludeDuplicatorAction', 11, 2 );	
    
    add_action('pre_get_posts' , function(){
    	global $post;
    	$postType = get_post_type($post);
    	if(in_array($postType , array('acf-field-group'))):
    		remove_action('post_submitbox_misc_actions' , 'mtphr_post_duplicator_submitbox');
    	endif;
    
    },10);
    
    
    rubybot

    (@rubybot)

    oops forgot to mention. If you have access to your themes functions.php file the above code will go in there. ??

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Remove duplicate from products’ is closed to new replies.