Help with SQL query, how to add taxonomie terms with value stored in options?

ok folks, i did it anothere way.. here’s how i did it: add_filter( ‘pre_get_posts’, function( $query ) { if( ! is_main_query() || ! is_post_type_archive() || ! $query->get( ‘section’, false ) ) return $query; global $wpdb; $section = $query->get( ‘section’ ); unset( $query->query[‘section’] ); unset( $query->query_vars[‘section’] ); $query->tax_query = false; $query->set( ‘tax_query’, false ); $cateroties = … Read more

Filtering posts by taxonomy and meta_value

I have finally been able to come up with a solution based on some help from my more MySQL oriented question at Stack Overflow: add_filter( ‘posts_fields’, ‘posts_fields’ ); function posts_fields( $fields ) { if ( ( is_woocommerce() || is_search() ) && ! is_admin() ) { $add = ” , CASE wt.slug WHEN ‘antique’ THEN 1 … Read more

Remove the post_content search from WHERE clause (and CONCAT sql function)

First look how complex is your preg replace. Usually, you may get into errors with that. NODE EXPLANATION ——————————————————————————– / “https://wordpress.stackexchange.com/” ——————————————————————————– \( ‘(‘ ——————————————————————————– \s* whitespace (\n, \r, \t, \f, and ” “) (0 or more times (matching the most amount possible)) ——————————————————————————– post_title ‘post_title’ ——————————————————————————– \s+ whitespace (\n, \r, \t, \f, and ” … Read more

How Can I keep password protected posts in the json requests but not on frontend queries?

I sort of solved this by using this: function ar6_password_post_filter( $where=”” ) { if (!is_single() && !current_user_can(‘edit_private_posts’) && !is_admin()) { $where .= ” AND post_password = ””; } return $where; } add_filter( ‘posts_where’, ‘ar6_password_post_filter’ ); This allows user roles of administrator and editor to still see the password protected posts on the front end of … Read more