The tag has no usage guidance.

learn more… | top users | synonyms

0
votes
0answers
17 views

Save custom field as 0000-00-00 00:00:00 (date) to meta_value in Wordpress

When I create a custom post type with custom field, how do I write to meta_value in database in int (0000-00-00 00:00:00) format instead of unixtimestamp?
3
votes
2answers
201 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
501 views

How to sort category by custom field value

I am using the following : $catargs = array( 'meta_key'=> 'category_custom_order', 'orderby' => 'meta_value_num', 'order'=> 'ASC', ); but I can get the ...
0
votes
1answer
865 views

Custom WP Query from meta_value stored as serialised array

I'm using a Magic Fields 2 multicheck box to store Services which can be assigned to Case Studies. The data is stored as a serialised array in WordPress, and I need some help to extract the "related ...
4
votes
2answers
778 views

How can I display all values of a custom field from posts with a certain value of another custom field or from certain post types?

I know the question is quite ambiguous. Let me explain: I have a page that lists all posts with a certain value of a custom field. (Eg.: The page Rentals lists all posts with the value rental of ...
0
votes
1answer
30 views

How to display checkbox meta array values one by one?

By wp user frontend I add some checkboxes to users frontend profile. When I use echo get_the_author_meta('my_pet', $author_id) output is: cat| dog| hamster And when I use this loop code $pet = ...
1
vote
1answer
56 views

new WP_Query to get max price meta value not working

So, I'm trying to get the maximum price of all 'properties' (custom post type). $max_price_query = new WP_query(array( 'posts_per_page' => -1, 'post_status' => 'publish', 'post_type'...
-1
votes
1answer
56 views

Add estimated value for a post according to the number of words

I have a blog where paid by 2 cents per word, need to add next to the word count one text value of statistics. Anyone have any idea how to make this automatic multiplication along with the word count?...
0
votes
1answer
26 views

query post by author gender

I'm using utimate member plugin on my website. for each member (author), I have a field to store the member gender. (Homme / Femme). the data is stored in my database, inside wp_usermeta. meta key ...
4
votes
2answers
49 views

Building a scalable Wordpress favouriting plugin - one serialised meta value array or many meta records

I am trying to build a simple Wordpress favourite post plugin that is scalable and could handle 1000s or 10000s of users or more. There are several different approaches that I have seen in other ...
0
votes
0answers
25 views

modify my custom meta_value after change post status from future to publish

I write a custom metabox form my wordpress. This is a check-box to flag some posts and this is work perfectly. To day I've try to schedule my first post and I've flagged this. Well, after publications ...
0
votes
0answers
30 views

get_posts ordered by custom field which is a custom date

I have a custom post type for members and the birth date is saved like 01.01.2013 $args = array( 'numberposts' => -1, 'post_type' => 'mitglied', 'post_status' => '...
0
votes
0answers
27 views

Order by meta_value_num issue

I am using meta_value_num to get the list of teams by their ranking, it working fine in 1,2,3,4 etc position, but in case of 11th, 12th, 13th etc position it consider them as a second position, the ...
10
votes
5answers
7k 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
1answer
48 views

Sort by meta value num, but ignore zero value

I have custom-post-type 'company' and taxonomy 'services' fot this CPT. I have created meta-field 'service_XXXX_price' (where XXXX is service id) for companies and fill this field with number. If this ...
0
votes
1answer
66 views

Query posts according to specific post meta values

I have a loop in my index.php for my home page like this... <?php if ( have_posts() ) : ?> <?php while ( have_posts() ) : the_post(); ?> I have a function to query the posts by ...
0
votes
1answer
65 views

Display Content Based on Custom Field Value

I have the following code which is trying to show an image based on the value selected from a custom field in the admin screen. <?php if( get_field('bias') != 'Neutral' ) { ?> <img src="...
0
votes
1answer
32 views

Plugin Shortcode value in post

Theme was output with function get_post_meta(get_the_ID(), 'some_value', true); when I try with die(print_r()); function there have some array containing values such as [item_ticket_tailor] => ...
0
votes
1answer
78 views

How to get user_meta value for new user regsitered?

We have a customized the registration process. Users register themselves. When a user registers, some meta values are updated based on the $user_id. Now we need to send an email. We have used action ...
1
vote
1answer
32 views

Sort meta-value in the sequence array in pre_get_post

I am customizing the display of posts in a category with pre_get_posts and meta_value . Each will receive a meta_value posts and wish them to be in the order of the array. I want it that way ( 1 ) ...
1
vote
1answer
70 views

Custom field value not saving when it contains a URL?

I implemented a custom field into one of my post formats called 'url'. When I enter a random string of characters into the field, it saves just fine and I display it in my template like this: <h2&...
0
votes
1answer
60 views

How to fetch meta_value and meta_key in matrix after ajax request by post_id

Well, I have 2 custom post types: A = Properties B = Property Owners Inside CPT Properties, I was created a Meta Box to: Search a registred Owner (CPT) by VAT number (CPF in Brazil) Relate Owner ...
0
votes
0answers
18 views

How do I delete a post through a meta_value

When I create a post in Wordpress, I determine an expiration date through a plugin called Post Expirator . My question is how I can delete these posts from the home page , categories and the like when ...
0
votes
2answers
146 views

How to get its meta_value of a specific meta_key within wp_usermeta

Using the S2member plugin, a meta_key for the last-payment-time is automatically stored in WordPress DB under table wp_usermeta (custom field is called wp_meds2member_last_payment_time). From ...
0
votes
1answer
236 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
0answers
31 views

Secondary ordering and order DESC not working when using meta_value_num

I have this query: $args_members = array( 'posts_per_page' => -1, 'post_type' => 'team_member', 'post_status' => 'publish', 'meta_key' => ...
0
votes
0answers
95 views

Adding filter menu to admin custom type list to filter by custom field values having issues

I've been working on this for a bit and am having some difficulties because I can't understand for certain what is going wrong and why I'm getting the error that i am. It's hard to tell if it's a WP ...
0
votes
0answers
37 views

Querying same column twice with wpdb (for postmeta values, specifically latitude and longitude)

I've seen similar questions around, but I just can't apply them to my case, I'm quite new at this, apologies. I'm trying to create a google map of my posts, using a latitude and longitude that are ...
0
votes
1answer
43 views

Filtering posts by taxonomy and meta_value

I am writing a plugin that will hide and sort posts based on tags and postmeta. Products tagged "antique" that are out of stock will be hidden by default. So far, I can hide sold products, but when I ...
0
votes
1answer
26 views

get_posts array 'between' not behaving

if I make the query of $apartments = get_posts( array ( 'post_type' => 'apartment','meta_key' => 'bedrooms','meta_value'=> array(4,12) , 'compare' => 'BETWEEN' , 'type' => '...
1
vote
2answers
57 views

How to get the total number of meta_values based on a custom post type?

I need to display the total number of votes that have been made for a specific custom post type. Here's an example of how the wp_postmeta table looks for these keys/values: meta_id post_id meta_key ...
0
votes
1answer
116 views

query_posts with meta_value

I have category 'news' http://localhost/foldername/news, for each 'news' posts I have custom field called 'years' and is set up as a Text Field. I have 2 values assigned n different posts '2013' and '...
0
votes
1answer
334 views

WP_Query with meta_value LIKE 'something%'

I have read several questions like this (for example, this), but no equal. I WP_Query need to perform a LIKE on a meta_value. My problem is that I want the like is as follows: meta_value LIKE 'value%'...
0
votes
1answer
64 views

how to query for meta_value have array

I have array in post_meta like this: array( 'option1' => 'true', 'option2' => 'true', 'option3' => 'false', option4' => 'true', 'option5' => 'false' ) and I would ...
0
votes
1answer
49 views

Show posts of an advanced search form

I have created a search form with multiple fields, and I want to display the posts that match all the fields inserted in the search form. For example, if I choose T-shirt && Red && L, ...
0
votes
1answer
795 views

Get an array of meta_values for a user meta_key

I need to get an array of all the meta_values for a user meta_key. I found this code: $cities = $wpdb->get_col("SELECT meta_value FROM $wpdb->usermeta WHERE meta_key = 'my_cities_meta_key'" ); ...
1
vote
1answer
473 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 ...
0
votes
1answer
355 views

How to delete only user meta value (not key) from usermeta table in wordpress?

I store multiple image in media library and save its id in wp_usermeta table. my metakey is 'images' and meta value in like '279,280,281'. Now I get the image from table like this: <?php $images = ...
0
votes
0answers
155 views

Sorting Posts with meta value not working

I want to retrieve most popular posts based on 'view_count' meta value, the below code doesn't seem to work, I am getting some random posts, where am I doing it wrong? <?php $mostpopular_args=...
0
votes
0answers
59 views

Make a button change meta_value

I would like if someone could point me in the right direction for doing this. Each post frontend should have a button that changes the database value on/off if the user is logged in. Ie.: post_id: 685,...
1
vote
0answers
203 views

Sort alphabetically by custom field

I'm trying to change the sort order of a custom field in a custom post type. I want it to be be alphabetical by the 'location' name. It's sorting by location, but not keeping them in alphabetical ...
0
votes
2answers
1k views

Using a pre_get_posts filter to search for multiple strings on all meta values

Using a pre_get_posts filter to search a given string on all meta_values: $query->set('meta_value', 'first string'); debug: AND ( (CAST(wp_postmeta.meta_value AS CHAR) = 'first string') ) ...
0
votes
1answer
65 views

Want to order by Meta Values (tweaking Post Order Widget)

I'm not much of a coder, but I can tweak PHP a bit. Basically I want to order by a custom meta value which integer called "price". The plugin orders by title, so thats what I'm changing to price, ...
0
votes
1answer
1k views

Query post order by post and desc not working

I have a query that displays post the order of the post 1 to 10 and front-end added: <?php print intval( $post->menu_order );?>º there shows 1º, 2º, 3º ... 10º must reverse the display but ...
1
vote
2answers
435 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
338 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
113 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
308 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' ...
1
vote
2answers
403 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 ...