Get orders of a specific customer woocommerce

Try using wordpress get_posts() instead $user_id = 22; $orders = get_posts( array( ‘meta_key’ => ‘_customer_user’, ‘meta_value’ => $user_id, ‘post_type’ => ‘shop_order’, ‘post_status’ => array_keys( wc_get_order_statuses() ), ‘numberposts’ => -1 )); echo ‘<pre>’; print_r( $orders ); echo ‘</pre>’;

how to get a list of all top level pages

$query_args = array( ‘post_type’ => ‘page’, ‘post_status’ => ‘publish’, ‘parent’ => 0, ); $pages = get_pages( $query_args ); Function get_pages() accepts parameter with parent. Keeping it 0 (zero) will give us first level pages. In the example $pages will contain the first level pages. Use loop for $pages and you can use it in option … Read more

cURL error for cron

This error is most often related to the server configuration! Contact your hosting company and ask the hosting support to check the following points: The server is running a recent version of PHP and the cURL library. Increase PHP Memory Limit settings. Ask your web host if there is some limitation with wp-cron, or if … Read more

A shortcode nested inside a shortcode

This should work: function cpa_haven_banner() { $shortcode = do_shortcode(“[get_sheet_value location=’LOAN!B7′]”); return ‘ <ul class=”list-group list-group-horizontal entry-meta”> <li class=”list-group-item list-group-action-item”> <strong>Female</strong> ‘ . $shortcode . ‘</li> </ul> ‘; } add_shortcode(‘cpa-haven’, ‘cpa_haven_banner’);

Function that replaces the image in the absence of the post meta

found the solution: $poster_path = get_post_meta($post->ID, “poster_path”, $single = true); if( $poster_path == “” ){ echo ‘<img width=”53″ height=”80″ src=”https://via.placeholder.com/370×556?text=No+Poster&000.jpg” />’; } else { echo ‘<img width=”53″ height=”80″ src=”https://image.tmdb.org/t/p/w370_and_h556_bestv2′.$poster_path.'” />’; }