WordPress tax_query “and” operator not functioning as desired

not tested but give this a shot ‘tax_query’ => array( ‘relation’ => ‘AND’, array( ‘taxonomy’ => ‘image_tag’, ‘field’ => ‘term_id’, ‘terms’ => 25, ‘operator’ => ‘IN’, ), array( ‘taxonomy’ => ‘image_tag’, ‘field’ => ‘term_id’, ‘terms’ => 41, ‘operator’ => ‘IN’, ) ), OR ‘tax_query’ => array( ‘relation’ => ‘AND’, array( ‘taxonomy’ => ‘image_tag’, ‘field’ => … Read more

Meta query with string starting like pattern

You could try the REGEXP version: ‘meta_query’ => array( array( ‘key’ => ’email_address’, ‘value’ => ‘^hello@’, ‘compare’ => ‘REGEXP’, ) ) where ^ matches the beginning of a string. You can check the MYSQL reference on REGEXP here for more info. Notice that these are the possible values of the meta compare parameter: ‘=’, ‘!=’, … Read more

How to set a custom post type to have viewable future posts

I’ve been able to solve this myself. My entire code for registering the CPT: <?php add_action( ‘init’, ‘events_post_type_register’ ); function events_post_type_register() { $post_type = “events”; $labels = array( ‘name’ => _x(‘Events’, ‘post type general name’, ‘project_X’), ‘singular_name’ => _x(‘Event’, ‘post type singular name’, ‘project_X’), ‘add_new’ => _x(‘Add New’, ‘event’, ‘project_X’), ‘add_new_item’ => __(‘Add New Event’, … Read more

tech