Error when activating a custom plugin on production server

Thanks to @the_hobbes and @Charles, I realized that the file Activate.php was not incorporated. By adding require_once plugin_dir_path( __FILE__ ) . ‘inc/Base/Activate.php’; to my code as shown below, it works correctly: function activate_adstoolbox_plugin() { require_once plugin_dir_path( __FILE__ ) . ‘inc/Base/Activate.php’; Inc\Base\Activate::activate(); } register_activation_hook( __FILE__, ‘activate_adstoolbox_plugin’ ); Oops! Newbie’s error …

Woocommerce product not appearing in category list page when created programatically [closed]

Try like $post_id = wp_insert_post( array( ‘post_title’ => $items[‘description’], ‘post_content’ => $items[‘detail’], ‘post_excerpt’ => $items[‘description_2’], ‘post_status’ => ‘publish’, ‘post_type’ => “product”, ) ); // Set Product type // wp_set_object_terms( $post_id, ‘simple’, ‘product_type’); wp_set_post_terms( $post_id, ‘simple’, ‘product_type’); // Get parent category returns mixed or objects $category_parent = get_term_by(‘name’, ‘Lense’, ‘product_cat’); // Get child category returns array … Read more

Warning: Illegal string offset ‘Andorra’ in … on line 106

It’s probably failing because Andorra isn’t a key in $evn_timezone. Can you var_dump($evn_timezone); so we can see what that contains? You can also add checks such as: if(isset($evn_timezone[$country->name])) { selected($evn_timezone[“$country->name”], esc_attr(“$country->name”), false); } That way, if the country isn’t in the array, you won’t get an error.