Post meta is a data set containing additional core as well as custom post information.

learn more… | top users | synonyms

1
vote
1answer
84 views

Delete all post meta except featured image

My aim is to clear up my database entries. I did a migration from blogger which added many useless post_meta. I found a plugin (db reset) that has the option to reset/delete all post meta. However if ...
0
votes
0answers
21 views

Edit is changing my custom's post type parent id

I'm having a custom post type (vehicle) and i attached a gallery (post) with image attachments in it. Through my custom frontend form, I set all the post and postmeta details right, as i want to, so ...
1
vote
0answers
36 views

How can I create a WP_Query that returns posts where one meta_value <= another meta_value

I have a working, pretty complex SQL query hand-written in a function. For the sake of leveraging WP_Query optimizations, and simplifying my code for maintainability, I'd like to convert it all to ...
0
votes
0answers
40 views

Trying to automatically set woocommerce product dimensions on save if left empty

So I'm trying to automatically set product dimensions & weight on a site if they're left empty, WooThemes told me I can use this as a starting point but the rest is out of their support scope. ...
1
vote
1answer
369 views

Update post meta in woocommerce order frontend

I will that the custome can update in the order the custom fileds (who was insert in the checkout page) I have this code in the order-details.php Page but it show only the value in the input but he ...
0
votes
2answers
124 views

Add multiple meta keys to a post at once

I figured how to add an input value as a meta key value to a new post from a frontend post form (thanks to @thedeadmedic), but I can't figure how to add two or more meta keys at once. Is this possible ...
0
votes
1answer
25 views

Add a meta to a post submited from a frontend form

I use a frontend form by @TheDeadMedic to post regular posts. I figured out how to add to this form a category and a location (custom taxonomy) dropdown menus, and also how to sanitize and how to ...
0
votes
0answers
43 views

Show posts in numeric price order using meta query combining 2 meta keys

I've built a custom estate agency website for a client but I'm stuck on this one last thing before it's good to launch. I'm using custom meta fields to allow for additional meta data such as Price, ...
0
votes
0answers
18 views

Generate meta_value programatically for thumbnail in Ruby

I am inserting posts in wordpress db using ruby. The problem is that adding a post thumbnail, there is a met_value field in post_meta table that has an auto generated hash which looks like a:5:{s:...
0
votes
1answer
27 views

Get post_meta from specific post [closed]

I'm trying to get the post_meta from a specific post. However: the following code breaks my document: $img= get_post_meta('4996','ATHLETE-side_img'; Then further down in the code I was planning ...
0
votes
1answer
98 views

How to add together (get the sum) a field from all author's posts

Using the plugin WPeddit I want to count the epicredvote score from all posts of an author together to get the sum. The following is a custom field that puts out a score, like "3" or "-2" or whatever:...
0
votes
1answer
53 views

Compile meta values from custom loop into array and then calculate sum total

I tried explaining this yesterday but I fear I made things more complicated than they needed to be. I have a custom loop that pulls through standard Wordpress posts with various arguments. $args = ...
0
votes
2answers
76 views

Order by post meta value gets random results

I want to order a custom post type by post meta field. This query works fine partially and load results. The problem is that the order of results vary at each time this query is executed. I have ...
0
votes
1answer
24 views

Count of posts by different parameters?

I need to get the count of posts (just a number, nothing else) by custom taxonomy AND post meta(string) but I can't find a good way to combine them both. Im fairly new to programming & WP, Im ...
0
votes
2answers
329 views

Get post id within comments loop

I have a custom comments loop on my author.php page. I am trying to get the post id so that I can echo the permalink for the post that the comment belongs to. Also so I can echo some post meta custom ...
3
votes
2answers
150 views

Is there a hook / action that is triggered when adding or removing a post thumbnail?

I'm trying to update a custom field after a post thumbnail (Featured Image) is either added or removed from a post. The aim of this is to keep track of whether a featured image has been added or ...
0
votes
0answers
76 views

Insert image caption (metadata) in shortcode in functions.php

I've created a shortcode that displays a random image given that certain parameters are filled, like img url and number of images to random through. It looks like this: function randimg_shortcode( $...
0
votes
0answers
186 views

How to find field key name of meta values ?

Using visual composer to create custom grid elements made me wonder: how can I find the field key name of a meta value ? I need these to include in a template of a grid element or for different ...
0
votes
0answers
68 views

Custom Table for custom post type meta data

I'm looking to store the meta data for a post type in a uniquely named table. You see I have a site with a large amount of custom post types with a large a mount of custom fields. I want to clone ...
0
votes
0answers
8 views

How to use Wordpress Functions in php file linked to email piping

I'm writing an plugin to add meta data to a post when I receive an email. So far my plugin receives the email correctly, but I need the WordPress functions to update the metadata. I can already get ...
1
vote
1answer
37 views

How to permanently delete a post meta entry?

delete_post_meta seems to merely clear out the value for a given post meta key. It doesn't really completely delete the row. I've been digging a lot, but I can't seem to find any function out there ...
0
votes
1answer
132 views

How can I output WPAlchemy repeating fields meta values in my page template?

I have a custom post type, Downloads, which contains some custom metaboxes, including a repeating field. I'm able to output the values for all of them in my page template, but I'm not able to output ...
0
votes
1answer
35 views

Query Posts based on custom field value

Currently building a site and need to create a 'Schedule' to display a Presenter that is on air at a particular time. Using ACF plugin to enter a time that the presenter goes on air which saves the ...
0
votes
0answers
55 views

WP_cron not updating post meta, instead clearing it

I'm trying to store social media follower count (ex. FB fans, Twitter followers) in post meta daily with wp_cron. If I manually save the post it will save the social media count numbers correctly in ...
0
votes
1answer
30 views

Retrieve posts from meta key

I'm trying to query the list of posts using the meta_key but the result I got back was an empty array. To write the data, I used the following codes: $post_id = 2; $user_key = '...
0
votes
0answers
26 views

Problem saving meta data

I'm making my first WordPress plugin. I used an example to save text that an administrator enters when submitting a new post, but the meta data is not saving. Can anyone help on that? /** * Adds a ...
0
votes
1answer
49 views

Show number of posts by logged in user

How to display the number of posts written by the logged in user. Here is what i got from the codex so far <?php echo 'Number of posts published by user: ' . count_user_posts( 5 ); ?>
0
votes
1answer
54 views

Get audio metadata on file upload

I am trying to fetch all audio metadata when I upload a file. This all happens in a plugin, and I currently use the add_attachment action to trigger my custom function : // link add_action( '...
0
votes
2answers
83 views

Only allow one meta key value per post in a category

I have created a meta box for a theme I am working on, it is a simple meta box with a check box for featured post. The problem is user can tick that check box for multiple posts in the same category. ...
0
votes
1answer
106 views

Hide posts with meta key in WP_Query

I was reading this post to "Exclude posts with specific meta_value" but it does not work correctly. Here is the arguments I am passing to WP_Query : $args=array( 'cat' => $catid, ...
0
votes
0answers
77 views

Create a Gallery and update Post Parent of Attachment Images

I need to create a gallery for a custom-post and update the post_patent of every image with the new gallery ID function create_tfuse_gallery_group($post_id) { if ( get_post_type( $post_id ) == '...
4
votes
2answers
436 views

When using add_post_meta and update_post_meta, is there any way to give the individual arrays keys?

When adding arrays to post meta, using add_post_meta, new sub-arrays are added. I was wondering if there was a way to have those sub-arrays named. so instead of ending up with array([0](2,3), [1](...
3
votes
1answer
137 views

Multiple meta values for same meta_key adding on “Preview Changes” hit but not on saving or updating post

I'm taking multiple location values with each post, so it's an array (always). My post meta form field is like so: <select name="<?php echo $project_prefix; ?>offer_locations[]" id="<?php ...
0
votes
2answers
80 views

Modify WP_Post before processing

I am looking for a way to modify WP_Post object before it's processed and displayed on the page. Reason - I built my site when WP was still in version 2.0, or even earlier. I didn't attend to it for ...
0
votes
0answers
29 views

Query all posts sorting first by the ones that match criteria, then the rest

I have two custom post-types 'office' and 'work'. A work is made by one office (I store the office ID in a meta of the work, named OFFICE); Now, in single-office.php, I need to list all the works, ...
0
votes
1answer
27 views

How does WP decide how to display a page

I am new to WP. I tried reading up as much as I possibly can online, and via browsing through the files. As far as I can tell, no physical pages/links are stored on the disk, so when a page is created,...
0
votes
1answer
45 views

Hide post title input for all roles except admin

How would this function need to be updated to exclude the admin? add_action('admin_init', 'wpse_110427_hide_title'); function wpse_110427_hide_title() { if (current_user_can('subscriber')) ...
0
votes
0answers
55 views

Search on Category and BETWEEN custom meta field

Background I am building simple car theme where I want to review cars, however, I'm really struggling with my search implementation. I have added a couple of custom meta fields to the post including ...
2
votes
3answers
149 views

Order posts according to user defined order for meta values?

I have set up some CPTs and storing a meta key/val for each of them. When I get those posts, I need to order them by the meta value, but, the order of the meta values will be defined in an array by me....
0
votes
0answers
21 views

Ordering results by last login date

I want to order posts by a post meta field and last login date. Here I use a custom post type called 'Agents'. Agents is a user group and they can login through frontend. For Agent logins, I record ...
0
votes
0answers
38 views

How to link images to a certain property type

I've build a web page, in which an user certain data; the user can add also images, and once everything is done, he/she clicks submit and a Property post type is added. The problem is that the images ...
1
vote
1answer
27 views

Query metas (and not : query posts by metas)

If I understood well, the WP_Meta_Query from Wordpress allows you to query posts by metas. But what I would like to do is to fetch metas; not posts. And I would like to fetch those metas without any ...
0
votes
0answers
138 views

Add post meta to search in admin of a custom post type

I am using woocommerce in a wordpress theme and I can't get the search functionality in the admin to include a meta value of 'shop_order' custom posts type. I've been trying to modify the following ...
0
votes
1answer
495 views

How to enable revisions for post meta data?

Normally wordpress keeps revision of wp_post table. But for generating a report I need some custom fields to be tracked while any update happens. As custom fields are saved in wp_postmeta table I need ...
0
votes
0answers
88 views

How to get meta value based on latest post id with group by term name

my query is SELECT terms.name as artist_name, wposts.ID,wpostmeta1.meta_value as image FROM wp_posts wposts LEFT JOIN wp_postmeta wpostmeta1 ON wposts.ID = wpostmeta1.post_id and wpostmeta1....
0
votes
1answer
36 views

How to add more than one custom metadata as filter on the post list page?

To add a filter based on metadata to a post we use the following format: $wp_query->query_vars['meta_key'] = 'meta_key_name'; $wp_query->query_vars['meta_value'] = meta_value; How can I add ...
0
votes
1answer
92 views

How to display Meta Field Value?

I am trying to display the value of a Meta field on single.php. The Meta Key is 'current_rank'. I tried... <?php echo get_post_meta( get_the_ID(), 'current_rank', true); ?> This code does ...
0
votes
1answer
34 views

Update event post meta each day automaticaly

Is there any way to update post meta value each day (daily automaticaly) ? For example my event has started each day at 10pm my current post meta is: 2015-01-01 10:00 next day i should change it to ...
0
votes
1answer
115 views

Check if value exists before saving

I added an extra registration field: function wooc_extra_register_fields() { ?><p class="form-row form-row-first"> <label for="billing_cpf"><?php _e( 'CPF', 'woocommerce'...
1
vote
1answer
204 views

How to sanitize post meta field value?

I have added a meta field for text input. I want to allow some html tags such as <strong> and <i> For example: <strong>hello</strong> world I can save the input field value ...