See the process of creating a taxonomy and tell me where I made a mistake

You shouldn’t be doing this: $searchProductsByCategory = [ ‘posts_per_page’ => 1, ‘post_type’ => ‘product’, ‘ignore_sticky_posts’ => 1, ‘orderby’ => ‘id’, ‘tax_query’ => [ [ ‘taxonomy’ => ‘product_category’, ‘terms’ => get_queried_object_id() ] ] ]; $foundProducts = new WP_Query($searchProductsByCategory); The whole point of taxonomy-product_category.php is that posts for the current category have already been queried. This is … Read more

How to Create Short Code Using Custom Post type

Try this /** * Register all shortcodes * * @return null */ function register_shortcodes() { add_shortcode( ‘listing’, ‘shortcode_mostra_produtos’ ); } add_action( ‘init’, ‘register_shortcodes’ ); /** * Produtos Shortcode Callback * * @param Array $atts * * @return string */ function shortcode_mostra_produtos( $atts ) { global $wp_query, $post; $atts = shortcode_atts( array( ‘type’ => ” ), … Read more

Custom post type efficiency

As the reading of the database is lightning fast, I would not worry too much about it. You have got a few points to consider: If you want to have all your metavalues queryable by the standard wordpress queries, you have to save them into different records. If you have a big, standardized set of … Read more

Give Friend Post Management

If you are an admin user, you could just change the author of the post (in the post editor Author box) to that of your friend. Admins already have the power to manage anyone’s post. By changing the name of the author on the post to that of your friend, you both can manage the … Read more

WooCommerce – Complete Order when an action occurs

Remove return; from your code, which is prematurely exiting the function before the following two lines can be executed; that is why the status is not changed. function my_change_status_function () { global $post; $ordernumber = get_post_meta( $post->ID, ‘order_number’, true ); $audit_status = get_post_meta( $post->ID, ‘audit_status’, true ); if ( $audit_status == ‘Complete’ ) { $order … Read more