Hook into the Admin Dashboard and redirect users
Hook into the Admin Dashboard and redirect users
Hook into the Admin Dashboard and redirect users
Assuming you mean $post->ID, you can use the post_link and post_type_link filters to append your query string. We’re using the add_query_arg() function to do this: /** * Modify the posts navigation WHERE clause * to include our acceptable post types * * @param String $post_link – Post URL * @param WP_Post $post – Current Post … Read more
How can I get posts by 2 meta keys, prioritising one of them?
Okay, I found the problem by debugging the query. It was a generic LEFT JOIN added with the posts_join filter that has not alias the $wpdb->postmeta table which finally leads to the error. So the sorting is working now without problems.
add_action( ‘init’, function() { add_rewrite_rule( ‘(.+)/search/(.+)/?$’, ‘index.php?post_type=$matches[1]&s=$matches[2]’, ‘top’ ); } ); It works done.
if you are trying to query from the same database in which your WordPress is installed then there is a great way to do sql query with ease. WordPress has a database access abstraction class called wpdb that allows you to run raw mysql query without any issue. You can start using it like one … Read more
I can’t find any examples that combine the $query->set(‘property’, ‘value’) syntax with an array assuming that’s the correct method In your $args array, you defined both meta_query and orderby as arrays, and they are each an arg for WP_Query (or a value for the “property” above), hence in your custom function (set_post_order_in_admin()), just use $query->set( … Read more
You can try this $args = array( ‘post_type’ => ‘Product’, ‘orderby’ => “name”, ‘order’ => ‘ASC’, ‘posts_per_page’ => -1, ‘post__in’ => $productIds );
Try this global $wpdb; $sql = “SELECT display_name FROM “.$wpdb->prefix.”users WHERE id IN (SELECT user_id from “.$wpdb->prefix.”usermeta where meta_value LIKE ‘%agent%’)”; $result = $wpdb->get_results($sql);
Cannot get sql request from Query object?