All Questions
Tagged with wp-query categories
283
questions
0
votes
1
answer
142
views
why same category base and single post base don't work?
I have checked a similar question on the site but there was no satisfactory answer? Here is what I would like to accomplish.
When I set the permalink structure to '/blog/%postname%/' this gives me the ...
0
votes
1
answer
19
views
WP Query filtering by custom category not showing all relevant posts
Here's a question I've been trying to solve all day:
I added a WP Query that would show posts from a category that the admin chooses with a custom field. The post is a custom post type called "...
0
votes
0
answers
14
views
Query for posts belonging to multiple categories
Within the default Post categories I have
A parent category Cities
-- City A
-- City B
-- City C
A parent category Beauty
-- Hairdressers
-- Pedicure
A parent category Sightseeing
-- Archeological
-...
0
votes
1
answer
41
views
Excluding a category from frontpage but not from WP_Query
I am successfully using this functions.php snippet to exclude category 3 from the WordPress homepage:
function exclude_category_home( $query ) {
if ( $query->is_front_page ) {
$query->set( 'cat',...
0
votes
0
answers
56
views
Advanced Search - Is this possible?
I am currently working on a Wordpress website that needs an advanced search adding to it.
I have three categories set up, each with a set amount of sub-categories, and then I'd like for a user to be ...
0
votes
1
answer
218
views
How to get post taxonomy url and name in wp_query
I have custom taxonomy (video-category) and custom post type (video). I want to show taxonomy link and name in my post items in WP_Query loop.
I use this to show that, But not working:
<?php ...
0
votes
0
answers
206
views
Pagination only showed when no category is set in wp_query
tldr: On my production site only, when I set category_name to any category my pagination does not show up. Once I remove category_name from my wp_query the pagination shows up (for all posts on my ...
0
votes
1
answer
21
views
Using WP Query, I want to include all posts in category 1 as long as they are not also in category 2
$args = array(
'post_type' => 'product',
'meta_key' => 'sorting_weight',
'orderby' => 'meta_value_num',
'posts_per_page' => -1,
'order' => 'DESC',
'tax_query' =&...
0
votes
1
answer
76
views
filter on get_posts efficiently
I have posts with the following categories:
A category that is a year(2017,2018...2022), a category that is type:(worldwide,Europe, local)
I am trying to give users in the frontend advanced search ...
1
vote
1
answer
61
views
Filters do not work when there are multiple (one works)
I have this functions code:
function my_query($query)
{
if (is_post_type_archive('mycustomposttype')) {
$orderby = sanitize_text_field(get_query_var('orderby'));
$orderby2 = ...
0
votes
0
answers
293
views
Display all categories (with link) of custom post type - Wordpress
I have custom post type "case study". Inside it i have few categories.
I want to display all existing categories from this "case study" CPT.
I successfully listed items from CPT on ...
0
votes
0
answers
35
views
List categories using WP_Query
I am on a filter hook where I can manipulate the $query_args of WP_Query. I am aware that WP_Query is meant for returning post data.
The question is:
Is there a way to get a list of the existing ...
0
votes
1
answer
114
views
Is it possible to make is_category() recursive?
In resetting the main query for category pages for a custom post type, I would like to write one test for a parent category and have it test positive for all child categories, recursively.
For example,...
0
votes
0
answers
116
views
get_the_terms has strange result since version 6.0
Since version 6.0 of WordPress some of my code with get_the_terms() doesn't work as expected in several sites where I use custom query loops.
For example I have this loop where I want to get the ...
0
votes
1
answer
424
views
Use get_cat_ID to retreive multiple category IDs
I am trying to use the names of categories stored in user meta (ie users' preferences) to control an on-page query’s parameters.
$topicsofinterest = get_user_meta(get_current_user_id(),'...