Hot answers tagged

3

Your syntax is complete wrong in your meta_query. A key/value pair in an array should be in the format of 'key' => 'value'. Your format is 'key', 'value' which in context of an array translate to 0 => 'key', 1 => 'value'. That is why your meta_query does not work. Your failure is also due to not very good housekeeping. As your meta_query is ...


2

Wordpress comes preloaded with the scripts to do datepickers. If you dont want to do it with a plugin, create a regular text metabox, then you need to enqueue a custom script in the wordpress admin with jquery-ui and jquery-ui-datepicker dependencies: function enqueue_date_picker(){ wp_enqueue_script( 'field-date', ...


2

Fixed query select p.ID as order_id, p.post_date, i.order_item_name, max( CASE WHEN im.meta_key = '_product_id' and i.order_item_id = im.order_item_id THEN im.meta_value END ) as Prod_ID from wp_posts as p, wp_postmeta as pm, wp_woocommerce_order_items as i, wp_woocommerce_order_itemmeta ...


2

This should be possible with the tax_query parameters for WP_Query. The query is either for posts where any term NOT EXISTS, OR, for any posts where the term IDs are IN the provided array. 'tax_query' => array( 'relation' => 'OR', array( 'taxonomy' => 'group', 'operator' => 'NOT EXISTS', ), array( ...


1

Note that if you have the post slug, you don't need the additional taxonomy query to find that post, so it makes sense to drop the expensive taxonomy query in core in that case. Otherwise you could try instead the post_name__in parameter: [ 'post_name__in' => [ '<postslug>' ], 'tax_query' => [ [ 'taxonomy' ...


1

Pass the array of arguments with key include. $tags = get_tags(array('include' => '10, 11, 34, 35'));


1

Just found the answer.. Add posts_per_page in the arguments as -1. It should look like this: $args = array( 'post_type' => 'lirik_melayu', 'posts_per_page'=> -1, // set the limit post to UNLIMITED (-1 is unlimited) 'orderby' => array( 'ID' => 'DESC' , ), ); $query = new WP_Query( $args ); ...


1

There are few issue with your code When using WP_Query in conjuction with the_post() or using get_posts() in conjuction with setup_postdata( $post ), you need to reset the $post global with wp_reset_postdata(), not wp_reset_query(). wp_reset_query() is used in conjuction with query_posts() which you should never ever use You would want to reset posdata ...


1

I tried to google "wordpress sql to get post url" and I was pretty astonished I couldn't find any resource sharing the SQL code to join the wp_post table with the table containing the permalink. That is because there is no table containing the permalink. Your "challenge" and your "astonishment" are because you've imagined the system to work in a ...



Only top voted, non community-wiki answers of a minimum length are eligible