All Questions
2,682 questions
4
votes
1
answer
3k
views
WP_Query min and max values
I'm building a houses class and I want to filter these houses with a query. But don't get any results:
Example house:
Min price: 10
Max price (field not required): empty
I've a price filter ...
0
votes
2
answers
786
views
Extending WP Query: Custom geolocation meta values work, but tax_query breaks
I've built a custom query for geolocation searches. I'm saving lat and lng within each custom post type as a meta value. My query extension returns results successfully when lat and lng are the only ...
1
vote
1
answer
2k
views
Meta query with order by another custom field
Edit: I will try to explain in detail my problem.
I am working on a portfolio site. There are a few custom post types: Projects, Publications, Exhibitions, Lectures, and Slides. The home page consists ...
1
vote
2
answers
1k
views
Orderby my needs in foreach loop like by title or something?
in a cpt i can check some values (checkboxes) in a metabox. i can access this values by
$meta = get_post_meta(get_the_ID(), '_custom-meta-box', true );
after that, i do a foreach loop:
foreach ($...
0
votes
1
answer
1k
views
Custom Meta Box (SELECT) Not Saving
I am trying to create a meta box with select options for each page with home-page-template.php assigned to it. I have got that functionality working correctly.
I also want it above the editor, below ...
0
votes
1
answer
12
views
Query 'orderby' when there are multiple values for the same meta_key
I'm trying to create a custom sortable admin column for a custom post type that contains a "repeater" field. The plugin I'm using for this field saves the values as separate entries in the ...
0
votes
1
answer
16
views
How to order product for key exists?
I'm trying to order the woocommerce products by the existence of a specific meta key, in particular: I need to display first the products that have this meta key, and the all the products that doesn't ...
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 ...
0
votes
0
answers
22
views
Select posts using @wordpress/data with query based on custom field always returns all records
I am trying to select records that have a custom field value that matches a search condition but the result is always all records
To register the custom field for my post type I am using the following ...
0
votes
1
answer
823
views
Unable to gather Image URL from Custom Post Type's; Custom Meta Field
I have wrote a very basic plug-in, it creates a Custom Post Type (CPT) that has multiple custom meta fields.
I cannot seem to echo out the Image URL. I have tried a heck of a lot of other similar ...
0
votes
2
answers
1k
views
How to sort WooCommerce products page by latest in-stock items first?
How to sort the WooCommerce products page by latest in-stock items first and all the out-of-stock items to the last?
Currently, I'm using a code snippet from "https://www.businessbloomer.com/...
0
votes
2
answers
991
views
Custom metabox with image gallery upload that won't attach images to post
I have created a custom metabox with an image uploader that will upload multiple images into a gallery that I can then query. It all works accept for the fact that the images don't show as attached to ...
0
votes
1
answer
1k
views
Get value of submit button in custom post type
I'm trying to make a quiz plugin. Using a custom post type, I've made a meta box, that has the following form table in it.
<table class="form-table">
<tbody>
<...
1
vote
1
answer
2k
views
How to Upload CSV Data into Custom Post Type Data with Metabox programmatically
I have a Custom Post Type called movies which had only title enabled from post support and 3 custom field of metabax as box office, year, and director like
now I have like 150 rows CSV formatted ...
0
votes
1
answer
2k
views
Get unique post by meta value using wp_query
I use wp_query to retrieve my posts by using a meta value. One of the meta values have the same text stored in the database. Let me give an example.
Post title Meta value
hello1 text1
hello2 ...
0
votes
1
answer
2k
views
Use WP_query to match post types based on custom field values
i'm trying to query posts from the post type Product that match with the current post in the loop from the post type Item, based on the custom fields product-ean and item-ean.
For example: i have a ...
0
votes
0
answers
19
views
Inequality based on today's date and SCF date not working
I have the following custom query and I would like to exclude any posts whose SCF dates are in the past. I have checked that the custom date of the post is returned in the Ymd format and it is. I can ...
0
votes
1
answer
985
views
How to create better WP_Query to look for date time which is anywhere between two meta values?
The following arguments are used for WP_Query to check if a reservation for a game can be created.
Meta input fields for post are created using ACF DateTime Picker and set to Y-m-d H:i:s
$start_date =...
2
votes
1
answer
2k
views
ACF repeater field with meta_query
How can I use a repeater field with meta_query I have a repeater field with some text values only and have a form that sends variables to a page where I get the value and storage a value which is the ...
0
votes
2
answers
805
views
Selecting posts older than the current Unix epoch timestamp
I am trying to perform the following query, which originates by the fact the post's 'date' and 'time' are entered as separate custom fields.
$args = array(
'post_type' => 'some_kind_of_posts'...
0
votes
2
answers
771
views
Add URL to selected post in meta box
How can I change this code
$posts = get_posts(array('post_type'=> 'lesson', 'post_status'=> 'publish', 'suppress_filters' => false, 'posts_per_page'=>-1));
//here you add the ...
1
vote
2
answers
2k
views
How to create a meta_query to get all posts with a specific meta data?
Here are the args for my query :
$args = array(
'post_type' => 'product',
'posts_per_page' => -1,
'meta_query' => array(
array(
'key' =>...
0
votes
2
answers
2k
views
How to use germ_terms() with meta_query for ACF Taxonomy field?
I have a custom taxonomy, Events (“event”).
Through ACF, this also has a Taxonomy field, “Topic”, linking it to a secondary taxonomy, Topic (“topic”).
I want to get_terms() for all Events terms ...
1
vote
1
answer
760
views
Getting List of all registered Dashboard Widgets
I am trying to get a list of all registered meta boxes in the wordpress admin, specifically the Dashboard widgets.
Now this is easily achieved with the global variable $wp_meta_boxes and does exactly ...
1
vote
0
answers
40
views
Display posts in correct month order using single date custom field
I have developed a WP Query that displays posts from a custom post type and taxonomy, and orders them by date using a custom field.
The posts have a single Advanced Custom Fields date picker field ...
0
votes
1
answer
743
views
Unusual high query of user meta data
We have a WordPress installation with many plugins installed. The site is not that highly frequented (maybe 10-20 concurrent users). I know the amount of plugins comes at a cost of performance. ...
2
votes
2
answers
1k
views
Adding Meta Boxes while Registering a Post Type in a Class
I am trying to add a few meta boxes for a Custom Post Type through a Class. I am using the "register_meta_box_cb" parameter while registering the Custom Post Type to specify the callback function for ...
1
vote
2
answers
1k
views
Wordpress from url get external source title
Hi I am building a news website. I am trying to automate it.
News url (metabox)
Title
Content area
Image (featured image option on wordpress)
When paste the site url I would like the other metabox ...
0
votes
2
answers
1k
views
Conditional posts in WP_query for search
I have a custom post type that im trying to limit results in search.
The CPT is a deal/coupon, with a start and end date for each of the deals.
What I'm trying to do is only show these posts in ...
0
votes
1
answer
2k
views
Wordpress meta query with meta serialized data array value
Looking for a method to nest AND/OR relation in meta_query based on array serialized values.
Reviewed these already:
Query multiple meta key values?
WP Meta Query for some meta (array) values
I ...
0
votes
1
answer
1k
views
Repeatable field within repeatable group of fields
Compounding on Saving metabox repeatable fields ...
I've created a metabox with a series of fields that are repeatable. However, within those fields, I'd like to create another field named Choices ...
0
votes
1
answer
1k
views
How to get an archive page meta?
Im trying to get some meta from the plugin Yoast Seo, set to a archive page of a custom post-type. What am I doing wrong?
$titleSEO = get_post_meta( '_yoast_wpseo_metadesc', true);
0
votes
2
answers
3k
views
Custom meta box repeated field
I want to add a field in my custom meta box, same as below, but not for tags. How can I repeatedly take more inputs in the same field?
Here is my code added to functions.php:
function ...
0
votes
1
answer
2k
views
WordPress AJAX load post metadata in modal
I have a custom page template (front-page.php) and I have a custom metabox which is assigned to this page template.
Metabox have 7 sections, and each section have 2 inputs. It looks like:
1. Client ...
3
votes
1
answer
1k
views
Working Bootstrap Carousel Conversion to WP - Technical Questions
I have coded a working Bootstrap carousel, it needs to be converted to WP. It's a small chunk of the site, but as a Wordpress newbie, am stuck in understanding the technical issue.
So here's what I ...
0
votes
1
answer
28
views
Two related taxonomies. how to filter terms in second taxonomy depending on selected term in first taxonomy on Post edit page?
I have two custom taxonomies on the site - Countries and Cities.
The Country taxonomy contains over 200 terms, and the Cities taxonomy contains over 47,000 terms.
Naturally, editing content with ...
3
votes
3
answers
3k
views
Best practice - Meta Query vs. post_clauses for "left join" ordering
Moreso a psuedo-code question than actual code. I have some custom post meta attached to attachments, and created a list table column for this meta. The meta is either 1, or null (not set), but I am ...
1
vote
1
answer
1k
views
Found 2 elements with non-unique id (#_ajax_nonce) and (#_wpnonce)
I am developing custom theme from scratch and creates a custom post type and getting this warning while editing custom post type. I also design custom Meta box with two input fields and using nonce in ...
0
votes
1
answer
3k
views
Create custom query for search?
I have create search box using ajax.If i enter any value in search input box that this value search in post title or post meta data and get all data of this value in custom post type.also query check ...
1
vote
2
answers
793
views
Outputing a metabox textarea and avoid line breaks inside li tags
I have added a custom metabox that holds string from a textarea in database. Now if I just simply echo the meta box like this:
$post_meta = get_post_meta($pid);
$answer = $post_meta["answer"][0];
...
1
vote
1
answer
33
views
Using Nested Blocks With Custom Query Block
I'm experimenting with a custom query block for the fun of it. I would like to leverage the components that come with core query inner blocks (title, excerpt, featured image, etc..). For this test, I'...
0
votes
1
answer
842
views
Search using specific meta fields only (excluding post title and content)
I have a custom post type my_cpt with 9 custom meta fields like first_name, last_name, location, phone, email etc along with post title and post content.
Now what I want is to search using first_name ...
0
votes
2
answers
2k
views
How to create frontend Post filter using meta query
I have created a post filter like the image below, but I have an issue with selecting multiple values from different fields. All the fields in the filter are custom fields. The thing is, in the admin ...
40
votes
14
answers
105k
views
Using meta query ('meta_query') with a search query ('s')
Trying to build a search that not only searches the defaults (title, content etc) but also a specific custom field.
My current query:
$args = array(
'post_type' => 'post',
's' => $query,
...
1
vote
3
answers
2k
views
Include custom fields into the content of a regular page
Here's my setup:
Parent "Gallery" page: _regular page, not custom type or anything _
Several "Project" child pages (could be as few as 1, unlimited
number): also normal pages
Child pages will either ...
0
votes
2
answers
3k
views
meta query multiple values for the same key
I'm trying to query wordpress with multiple values but it looks like it can't take no more than 4 keywords
I'm currently using a loop and I already tried to switch to a IN operator but I need the ...
0
votes
1
answer
1k
views
Filter result of Custom Post Type using meta_query with ACF
Im using a custom post type named property to list some houses and flats. In this cpt, I have multiple custom fields from Advanced Custom Fields plugin, such as localization, price, rooms and so on. ...
3
votes
2
answers
6k
views
Displaying Meta Box Image
I have some problems displaying info from my custom meta box in my custom post type single. I'm using Reusable Custom Wordpress Meta Boxes by Tammy Hart.
I'm able to display the textfields using this:...
3
votes
1
answer
904
views
Show or hide custom meta box not work with Gutenberg
I’m on WordPress 5 beta 4,
the problem is that meta boxes can not hide them when selecting a specific template chosen by page attributes.
To make them appear or hide, you have to update the browser ...
0
votes
1
answer
2k
views
Create Meta boxes dynamically
I followed and created a meta box using all code from this question here:
Create more Meta Boxes as needed
Basically only two fields are created when you click on Add track button:
Song title field ...