0

Wordpress wpallimport plugin This filter allows modifying the option shown in the options type dropdown for import

The function is as follow: I want to add $custom_types as string array.

function wpai_custom_types( $custom_types ) {   

   // Modify the custom types to be shown on Step 1.
    $custom_types = array("woocommerce orders" , " posts")
   // Return the updated list. 
   return $custom_types;

}
add_filter( 'pmxi_custom_types', 'wpai_custom_types', 10, 1 );

But it won't work

0

WooCommerce Orders are registered as shop_order not "woocommerce orders". Also you have a space in " posts".

Try:

$custom_types = array("shop_order" , "post");

Posts aren't custom post types in WordPress though. They're of the default post types that are registered in WP.

| improve this answer | |
  • i tried this and it didn't work but i contacted the support and they provided another function – Just mas Sep 16 at 1:54
0

For posts & products:

add_filter( 'pmxi_custom_types', 'example_import_show_only_posts_and_products', 10, 2 );

function example_import_show_only_posts_and_products ($custom_types, $type = '') {
    
    global $wpdb;
    
    $new_types = array();
    
    foreach ($custom_types as $post_key => $post_obj) {
        if ( $post_key == 'post' || $post_key == 'product' ) {
            $new_types[$post_key] = $post_obj;
        }
    }
    
    return $new_types;
}
| improve this answer | |

Not the answer you're looking for? Browse other questions tagged or ask your own question.