The tag has no wiki summary.

learn more… | top users | synonyms

0
votes
2answers
15 views

Add meta value to custom post type on publish

I have a client who is requesting that all posts of a certain custom post type (called 'custom-jobs') be set to automatically be included in the sitemap in the Yoast SEO plugin. I found that in ...
0
votes
1answer
12 views

How do i get value from wp_postmeta?

I am trying to get a specific value from wp_postmeta, I'm aware about meta_key and meta_value. Problem is Meta value stores lots of values and i want specific value. Here's the value in the ...
0
votes
1answer
41 views

Cannot order by in WP_Query

I'm stuck with this issue : I'm having a custom query in which I cannot order by anything. I want to order by a specific meta_value. But event when ordering by name, title, date etc, I still can't. ...
0
votes
1answer
69 views

Sort Order for a Custom Query in a Post Type Archive Not Working

I have a custom post type for events set up and am displaying the posts in a custom post type archive "archive-events.php". I am using Advanced Custom Fields to put an event date "event_date" on ...
1
vote
2answers
59 views

Meta Query relation “AND” then set array accordingly

I have a search form on my home page that sets up the url query_string accordingly for the code below. When I use or I get results. However when I used "AND" for the relation I dont get any results ...
0
votes
1answer
51 views

Wordpress loop based on url sting

I have a search form on my home page that contains ACF custom fields values in the dropdowns. On submit the form goes to /test-results/. On the form I have dropdowns for Price, Region and Title. If ...
0
votes
1answer
111 views

Order by meta value pro first then meta value free in my search function

My meta key is geo_listing_type and this key have 2 meta_value, pro and free. I want to order these by pro first then free <?php get_header(); ?> <!--Start Content Wrapper--> <div ...
0
votes
1answer
80 views

Meta query with compare by more than 2 fields

i have 5 sets of meta boxes in some custom postype. So.. i know how to compare two meta box values... Example: 'meta_query' => array( 'relation' => 'AND', array( 'key' ...
0
votes
1answer
29 views

Does meta_query working with value paramater higher then 999?

I am trying to get posts by price using query_post() function. Price must be in range between two values. This I made using meta_query. But when I cant get posts when right value higher then 999 in ...
1
vote
1answer
147 views

Ordering by meta_value AND date NOT WORKING with wp_query

I want to select posts and custom post type with a specific meta value (mb_home!=0), of last week and ORDER them by mb_home. If they have the same mb_home value, I want them to be ordered by date. ...
0
votes
0answers
45 views

Query to select specific users is not returning any users

I use wordpress and have the following query to select specific users, but the query is not showing any users when running it put together. global $wpdb; $date2day = date("d-m-Y"); ...
0
votes
1answer
43 views

Automatically delete posts based on query

I'm trying to delete certain posts (of a custom post type) automatically based on a comparison between the current time and a number of hours previous to now, for example 24 hours. The custom post ...
0
votes
0answers
65 views

Sorting meta_value as integer doesn't work

This plugin uses the below chunk of code to print the top 10 highscores. But this doesn't get the list of top 10 scores sorted by meta_value in my WP install $scoreboard = new WP_User_Query( array( ...
0
votes
1answer
72 views

Query to get all the posts of more than 2 meta_value having same meta_key?

Meta_value will have checkbox infront of them so when both the check box is selected posts related to both the meta_value will be displayed.
0
votes
1answer
24 views

widget exclude post by custom field

I have a widget that gets posts from different post_type's. I want to exclude some posts that have a custom field value e.g. I save a form where a checkbox adds a value of 0 or 1 depending if ticked. ...
0
votes
1answer
28 views

Echo only gives me the first part of string

So I was pulling some meta_value and trying to use it in a mass email and tested it first by echoing what I obtain in the array. In var_dump I see the array and that it gets my correct data, but when ...
1
vote
1answer
191 views

How to create a Custom Meta Box with Name/Value Admin User Input Fields?

I have researched many tutorials on how to create/add Custom Meta Boxes using the add_meta_box() Wordpress function. I can not find any example where the finished Meta Box has the option for an Admin ...
0
votes
2answers
60 views

Grouping posts by a custom meta value

I'm trying to output a list of dates that are held in a meta key called event_dates without duplicates. I've also tried a wp_query with a meta_compare but I'm not able to make that work either. Any ...
4
votes
1answer
111 views

Dealing with Many Meta Values, 30+

I have a "Listing" post type with 30+ meta keys which I feel like can cause a strain on the database when there's 100+ posts. Usually what I do is save each meta value 1 by 1 like so: ...
0
votes
2answers
384 views

WordPress Screwing Up 'orderby' => 'meta_value_num' in 'pre_get_posts'

I have a bunch of _ai_price_int meta values set up as just numbers. This is how the table looks: meta_id, post_id, meta_key, meta_value 1309, 1111, _ai_price_int, 6550 1310, 1115, ...
1
vote
2answers
91 views

Query Multiple Meta Values and display only when it has both meta values

I've been stuck on a problem for a while now and I can't seem to figure it out. I want to query posts and only display them if their 2 meta values checked contain the ones I have queried. For ...
0
votes
1answer
40 views

How can I use 'orderby' => 'meta_value_num' to order by the numerical value even if the value starts with a word?

I'm using 'orderby' => 'meta_value_num' to order some boats I have as a custom post type, the meta values ordered by, are boat models, which are normally just numbers but if you look at this page: ...
0
votes
0answers
263 views

Wordpress Admin Panel Search posts with custom post meta values along with title

Trying to modify default admin search by including search by custom post type fields, Below is my code, function custom_search_query( $query ) { $custom_fields = array( // put all the meta ...
0
votes
1answer
351 views

Does meta_value (array) work with 'orderby'?

My goal here is to query posts by a meta_key, with the values falling in between 1-100. When pulled, it is suppose to be ordered by ascending starting from 1 to 100. $post = array( ...
0
votes
0answers
66 views

How to filter a meta key with the meta values?

I have a custom post type wich I'd like to filter on a meta value. I already can sort the meta values from a meta key with the following code: // Register the column function status_column_register( ...
0
votes
1answer
349 views

Sort column on meta key and meta value

In the WordPress backend I'd like to sort a custom post type column on a meta key and meta value. The meta key is called 'status'. I've got three different meta value's for the 'status' key. How can ...
1
vote
3answers
2k views

Query to sort a list by meta key first (if it exists), and show remaining posts without meta key ordered by title

I'm working on a custom taxonomy term page template where we want the items that are connected to the term sorted by a publication date (custom date field) - and if there are multiple items on the ...
0
votes
0answers
99 views

Custom Field: Display only if a specific key is selected outside the loop

I might be doing this all wrong. I have a custom field called "enable_adsense" and the value can be either "yes" or "no" What I'm trying to do is display something if the value is "yes" and something ...
0
votes
1answer
33 views

How to output meta_key in wp_postmeta?

I have a meta_key in wp_postmeta called _su_description. How do I output its value?
1
vote
1answer
406 views

Query multiple meta values

I'm working on a 'checkbox filter' to query posts by checked values. See this link (EDIT: As you can see there are just 2 posts in this link, as soon as the user checks for 'MINI' it gets a good ...
0
votes
2answers
99 views

Sorting past events by month

I have a site that lists upcoming events and past events. In my category-past-event.php template, this is how I've gotten past events appear in descending order (from most recent to oldest): ...
0
votes
2answers
115 views

meta_value and meta_key filtering returning no posts [closed]

this might sound like a very stupid question, and I am almost ashamed to put it here... however, after using the code straight from wp codex, and trying a couple of other variations from googling ...
0
votes
1answer
100 views

updating one custom meta field only

i am trying to update only one custom field that is store in serialized form. By updating that field my other custom meta fields becomes blank/empty. how can i update only a specific meta value ...
1
vote
1answer
362 views

AJAX pagination offset returns same post on adjacent pages

I have a simple AJAX pagination that seemed to work just fine, calling one Wordpress page (not ideal, I know) with a pagenum and a sort order arguments and it returned 4 custom posts per call. The ...
2
votes
1answer
2k views

WP_query : meta_key with custom rule for specific value

I'm a bit stuck with a WP_Query code. Here it is : $args = array( 'post_type' => 'post', 'meta_query'=> array( 'key' => 'karma', 'compare' => '>=', ...
0
votes
1answer
360 views

How to get a value from comment meta

I've add the field country in the comment form. Working nice and I can see the value in the table commentmeta. Now I try to display this value in my comment list. In my single.php I call the list ...
0
votes
0answers
302 views

Check if meta_key exists in wp_list_pages

I have added a custom field (using Advanced Custom Fields plugin) to a page allowing you to show/hide it with a simple checkbox, i want to filter out these pages if a user is not logged in so i am ...
0
votes
2answers
708 views

IF Custom field value equals ZERO

I am trying to use the following code to check for my custom field for a value of ZERO to then display my div <?php $mp_price_sort = get_post_meta('mp_product_price'); if ($mp_price_sort == '0') ...
0
votes
2answers
88 views

How to show or hide a post based on meta_value selection?

How would I go about hiding a post based on a meta_value selection done on the back end. The usual method is to just change the post status from Publish to Draft however, I want this to work based on ...
0
votes
1answer
127 views

Saving zero as meta value

I have a meta_key called "_ordre" and each time I create a new custom post, a new meta_value is set for that meta_key. The thing is, when I set the value of '_ordre' to 0, the meta_value is not saved ...
0
votes
1answer
2k views

query posts and custom post type with meta key

I'm trying to query all-in-one-event-calendar's custom post type ai1ec_event and normal wordpress posts in a slider on my home page. That works pretty well. Now I want to query only the posts with ...
1
vote
1answer
212 views

Permalink structure by Post Meta value

I have the following issue: Two Custom Post Types, lets call them cpt1 and cpt2. In cpt2, I have a custom meta box in which you can select a post from cpt1, its post ID is stored in a meta value ...
1
vote
2answers
559 views

Multiple Values stored as array in Meta Query

I'm a little confused as to best practise for saving multi-select values in meta fields. Assuming <select multiple name="_casestudypost[]"> is my form field if I store ...
0
votes
1answer
119 views

Order by meta_key where value is serialized

I'd order post by meta_key but i've a problem with meta_value because is serialized object. I'd order my post per count value. a:2:{s:5:"count";d:9750;s:7:"timeout";i:1358466733;} I use below code ...
2
votes
0answers
120 views

Is it possible to orderby multiple meta_keys when using meta_value_num?

Reading through the order & orderby documentation, it's not clear to me whether there is any support to order based on multiple meta_key values. Obviously, using meta_query I can return posts ...
0
votes
1answer
111 views

Problem with meta_value order after update

I use following array and works fine... sort post by meta_key where value of t_count is a number: $args = array( 'posts_per_page' => 10, 'meta_key' => 't_count', 'orderby' => ...
1
vote
1answer
225 views

Job of meta_key meta_value fields in database tables

I'm researching the structure of WordPress database and there is something that really get me confuesd. Could someone please explain, what is the exact job of meta_key and meta_value fields in ...
0
votes
1answer
602 views

Add a default meta_value to new posts

I have a page template that allows users to create and update posts from the front end. I also am using 2 plugins, 1 that allows the user to rate posts from 1-5 stars and another that allows them to ...
1
vote
2answers
571 views

order by multiple meta_keys?

Hi i'd like to order by multiple meta_keys want to make it order using these keys adminscore + user_like + _count-views_all + comment_count combine these keys how should i array order it?? i try ...
-1
votes
1answer
530 views

Display a list of posts whose meta field values are equal to the ID of the post being viewed?

SOLUTION PASTEBIN LINKS:: http://pastebin.com/YmXVC1kn - Author Single Post http://pastebin.com/g0xgvxgh - Book Archive Template Please refer to these files here - solved by storing the post ID ...