Not getting input from get_query_var
Changed the query and with the direction kaiser gave I got it working. $area = $_GET[‘area’]; $persons = $_GET[‘persons’]; $query = new WP_Query( array( ‘tag’ => “$area+$persons” ) );
Changed the query and with the direction kaiser gave I got it working. $area = $_GET[‘area’]; $persons = $_GET[‘persons’]; $query = new WP_Query( array( ‘tag’ => “$area+$persons” ) );
Using WordPress’s wp_postmeta will help you a lot, instead of creating a new table. Functions like get_post_meta(), update_post_meta(), add_post_meta() etc, are readily available for use. All you need is to create a meta_key (which in this case will be wp_likes) and the meta_value (number of likes will be stored), which can be easily retrieved using … Read more
“order” does not affect order of custom query
It seems the problem is that for parent/child relationships, I’m using the Toolset Types plugin, which stores the relationships as fields rather than how WordPress normally thinks of them. This means that when WordPress looks at a post ID, it doesn’t see the child relationships that the plugin does. To get around this, I used … Read more
You can use the get_search_query filter. function mySearchFunction($search_term){ $search_term = substr($search_term, 0, -1); return $search_term; } add_filter(‘get_search_query’,’mySearchFunction’); EDIT Action to filter query results: function mySearchFilterFunction($query) { if ( !is_admin() && $query->is_main_query() && $query->is_search) { $search_term = $query->get(‘s’); $query->set(‘s’, substr($search_term, 0, -1)); } } add_action( ‘pre_get_posts’, ‘mySearchFilterFunction’); get_search_query filter is not needed because it uses get_query_var( … Read more
You can achieve that using the tax_query, see the example in the code below: $args = array( ‘posts_per_page’ => 10, ‘post_type’ => ‘product’, ‘post_status’ => ‘publish’, ‘tax_query’ => array( ‘taxonomy’ => ‘the_taxonomy_slug’, //the slug of the taxonomy you want to get ‘field’ => ‘term_id’, ‘terms’ => $categories ) ); See reference in the Codex
That page isn’t a 404, it’s returning a status code 200. The title and body tags also indicate that the page is loading just fine. A couple of things- there is no taxonomy argument. It would be redundant anyway, since the query already contains the queried taxonomy and term pulled from the parsed URL. Your … Read more
EDIT: I didn’t read your code properly, sorry! You’re using get posts which will only retrieve posts. To get all the images from the media library you’ll need to use WP_query. $query_images_args = array( ‘post_type’ => ‘attachment’, ‘post_mime_type’ =>’image’, ‘post_status’ => ‘inherit’, ‘posts_per_page’ => -1, ); $query_images = new WP_Query( $query_images_args ); $images = array(); … Read more
You haven’t mentioned what you want from this request and what is it for. You should clarify that to get the most accurate answer. Anyway, if you want to write a pure SQL request you can’t use WP_Query but need to use $wpdb->get_results instead, as mentionned by @hadimahoor. Here is a request to get a … Read more
Speed up search query that searches in post meta?