All Questions
Tagged with custom-field wp-query
366
questions
0
votes
1
answer
37
views
What is the easiest way to create a custom field archive?
So, here is the issue:
I am using a plugin named User Submitted Posts, and it works great on its part. However, I still want to have that user content page the Twenty Twenty Four theme has by default, ...
0
votes
1
answer
26
views
WP_Query not using relation key as expected and not producing any results
I have created a custom post type service-provider with custom taxonomies region and service-category - By itself, this search works as expected BUT I want to also search on an ACF field.
I have an ...
0
votes
0
answers
26
views
How to filter posts with a wp query by a custom dropdown type field with the magic fields plugin
I have been trying to obtain posts by filtering by two custom fields in a wp query, the problem is that I do not get the expected result, which is that I filter by country and by a value that I am ...
0
votes
2
answers
53
views
How to get products with the same custom attribute like ean code
I Try to get all products with the same ean code, but the query doesn't work and also doesn't give any errors. What am I missing?
Here is the code I use.
if (is_product()) {
global $product;
$...
0
votes
0
answers
49
views
Use Custom Field to Display Post Loop
In my custom template I have created a menu which is a row of 10 horizontal tabs. Each tab shows a date which is defined using an ACF datepicker field in the post.
I have also created a custom post ...
0
votes
1
answer
33
views
Sort wp_query of two post types using meta datefield for one and date for the other - possible?
I have two queries that result in id-arrays that I merge into a common array which, in turn, has all the posts I need from the two post types (posts, events). However, in the sorted list I would like ...
0
votes
1
answer
83
views
Order custom post type by posts with most likes first
I am using the Like/Dislike plugin on a custom post type and am trying to order the display of posts by the most like count down to those that have no likes (and no set meta value in the posts meta ...
0
votes
1
answer
259
views
WP_Query sort by ACF date field (newest first) with blank dates first
I have a custom date field that is optional. If a date is not provided, the item should be first in the items returned by WP_Query. Example:
1st: entry with no date
2nd: entry with date 1 March 2023
...
0
votes
0
answers
250
views
Query order by a numeric ACF field
I created a query for the custom post type of "departments" the query gets me every department with ACF field "type_of_cetifecate" = "bach" and with a certain category id,...
1
vote
2
answers
2k
views
How to include custom fields in wordpress search
As you know WordPress search only look at the post titles and contents, but I want the search to include also a custom field. Let me explain more:
Consider a movie post with the title "Fast Five&...
0
votes
1
answer
308
views
Best performance for use Custom Field in WP
I started building a custom theme and I might need to have around 10 to 20 custom fields for posts and I need to 30 custom fields for theme options and image ads banner, and thinking if this will ...
0
votes
0
answers
279
views
Extend search query to search meta keys values based on search string
I want to create an autocomplete AJAX search and I'm trying to have it where when the user starts typing, the list populates titles matching that search string.
My issue is in the WP_query, because I ...
0
votes
1
answer
26
views
How to initialise WP_Query on the basis of a specific meta_value and continue iterating rest?
I have a CPT with daily deals, I need to show these daily deals on my frontend as per today's day.
For eg, if it is Thursday : The returning array should return Thursday, Friday, Saturday, Sunday, ...
0
votes
1
answer
849
views
querying to custom field over ACF REST API
Iam using the "ACF" plugin with "ACF to REST API".
I found a solution for querying a custom field over REST API.
I inserted this into my functions.php:
add_filter( 'rest_{type}...
1
vote
0
answers
28
views
WP query with variables gives no result for specific user
I'm trying to fetch one custom post with two values: the logged in user ID and a known string, both as variables.
The query works out fine when testing on an admin account where the user ID is 1 and ...