Skip to main content

Unanswered Questions

1,760 questions with no upvoted or accepted answers
3 votes
1 answer
632 views

Generate a tabbed submenu — from taxonomy term or submenu item — with sample content

I'm looking to generate a tabbed submenu from taxonomy term or submenu item and include sample content (three items per term/submenuu item). The styling I can do, the problem is the html generation. ...
3 votes
1 answer
2k views

How to get a category in a list item class

I am need to know how would I get the category to be dynamically input in a WP_Query This is the code I am using: <li class="<?php the_category(' ')?>"> but the output is breaking. ...
3 votes
2 answers
9k views

How to create/modfiy WP_Query to search in post title OR custom field?

I need to modify or create a WP_Query that will search for a search term in both the post title OR a custom field (called 'my_field'). I have been reading and trying for hours, but I am right back to ...
3 votes
2 answers
810 views

How to target the default Recent Posts and Recent Comments widgets with pre_get_posts?

I added the following to my functions.php: add_action('pre_get_posts', 'keyl_get_emp_posts'); function keyl_get_emp_posts($query) { if ($query->is_main_query()) $query->set('...
2 votes
1 answer
52 views

How to create a three column blog layout with a single query and with three different classes?

I am trying to achieve the following layout : I have created a shortcode for this but I am not getting the desired result. Can anyone guide me where I am getting it wrong. Here is full shortcode. ...
2 votes
0 answers
28 views

get_meta_sql hook is not firing

WP_Query uses WP_Meta_Query. I thought this calls the WP_Meta_Query::get_sql() to define the meta query SQL which is where the get_meta_sql filter is applied. I can't get the get_meta_sql filter to ...
2 votes
1 answer
23 views

WP_query() Simulate Missing "NOT" relation to Reverse Results?

I have a working and complex "args" ("tax_query") array which returns results. I now wish to get the missing results, this is a "boolean" NOT operation (which "...
2 votes
0 answers
448 views

How to efficiently find "duplicate" posts, where the titles are different, using metadata to match posts?

The website I'm working on collects information on film reels. A 'film' is a custom post type. Each 'film' is one post. The user bulk uploads films from different sources. Because of this, some films ...
2 votes
0 answers
217 views

Query custom post type and group by taxonomy

I struggle a bit with my piece of code - it's main goal is to show list of custom post type (called "career") childs grouped by custom taxonomy. How it should work? A user see default list ...
2 votes
0 answers
1k views

is_user_logged_in not working from WP-API (wp-json)

I want to hide certain posts from visitors that are not logged in. The code below works perfectly when the visitor visit the page but not is I try to see all the pages from the API with wp-json/wp/v2/...
2 votes
0 answers
241 views

Hiding Draft Post In Admin

Does anyone know of a way to hide draft post so that when "All" post is selected, draft post is not included? I tried adding this code to my functions.php file but it lead to an error, I'm ...
2 votes
1 answer
318 views

Meta query field order together with post_date order causes posts without the meta field to be unordered

I've managed to get wordpress to do a descending order on a meta_query field called start_date which is saved in Ymd format in the database by the ACF plugin. However in my query the other post types ...
2 votes
0 answers
56 views

How to search by a post and a category name on wordpress at the same time?

I wanna change the default behavior of wordpress search engine. Basically, I want to choose between 2 paths when the user informs a term on the search input: Find the posts or custom posts that have ...
2 votes
0 answers
626 views

Show Post Count of a Category

I've been stuck on this for a little while now, and have tried multiple ways to achieve this with no luck. I've been looking for two ways to display the total posts found on a specific, and non-...
2 votes
0 answers
274 views

Iterating through $wpdb query without using get_results for large query results

Traditionally, whenever I've needed a real mysqli_fetch for things like importing thousands of rows of data, I've used my own database connection and framework. But I was thinking there must be a way ...

15 30 50 per page