This function returns the values of the custom fields with the specified key from the specified post. It is a wrapper for get_metadata('post'). To return all of the custom fields, see get_post_custom(). See also update_post_meta(), delete_post_meta() and add_post_meta().

learn more… | top users | synonyms

0
votes
1answer
463 views

get_post_meta fields don't show up on posts page

I'm new here, and to coding! I've been working hard (so, so hard...so hard) to create my website and with occasional help I've created a look and feel I like using some custom get_post_meta fields for ...
1
vote
1answer
646 views

get_post_meta unserialize issue - retuns boolean(false)

I´m using a simple custom plugin that parses and saves external XML data as a serialized array in a custom field. This works fine, however, when I update the post, instead of the array I only see a ...
0
votes
1answer
524 views

Display an icon with get_post_meta?

I want to display an icon in the post meta data in the loop.php, for each post have a specific meta_value! To be more specific i use this code to display an icon when a new posts has been published ...
0
votes
0answers
22 views

wp_get_post_terms returns empty array

So I have a Post term called JobNumbers, which holds jobnumbers per page. I then enter into the DB a count per page/jobnumber. This has historically been working, but something happened and now it's ...
-1
votes
0answers
29 views

How to get image url in this code

jQuery(document).ready(function() { //$.noConflict(); jQuery("#wp_custom_attachment").click(function() { event.preventDefault(); var file_frame; if ( file_frame ) { ...
0
votes
1answer
33 views

Query Multiple meta

Hi i've looked through the forum but can't seem to find the right solution to what i'm looking what we have is a property website and have various pages setup to show specific types of properties ...
0
votes
1answer
48 views

Get the correct meta_value with get_post_meta

I tried using the function get_post_meta() to get the meta values of my posts. However to my surprise it returns an Array that contains again arrays! So I looked inside the second level array, and was ...
0
votes
2answers
21 views

WP_Query with child element

I have my calendar events, I want to sort them by creation date with the query, but here's the issue: I have a meta key which has child values: First one is $data = ...
3
votes
1answer
47 views

Add options to featured image

I want to add an option to the featured image metabox. I have found a way to do this here The problem I'm having is saving the value tot the database. Here is what I have tried: add_filter( ...
0
votes
1answer
581 views

Dynamically get the meta key value of a menu item based on it's post ID

I have a menu, that I need to insert an image that have it's path saved in a meta key (_menu_item_img) and associated with a post ID, every menu entry has it's own image, and I need to grab it ...
1
vote
1answer
41 views

Meta Key Value in current-user-only loop

I created a loop for logged-in-users-only which works perfectly for all data except for meta keys. I'd like to be able to also extract meta keys but had no luck so far. This is my loop (based on this ...
0
votes
1answer
46 views

get_post_meta returning broken path in image src

I am using a custom field to store the path to an image and then using get_post_meta() to insert that path into an <img> Here is my code: <img src"<?php echo get_post_meta( get_the_ID(), ...
0
votes
0answers
19 views

how to display meta box data on page?

i have this function in my function.php and i am trying to display the meta box data on my page. Can not do so. function designation_meta_box($post){ wp_nonce_field( ...
0
votes
2answers
183 views

Why is get_post_meta returning an array when I specify it as single?

The documentation from get_post_meta makes it sound as if the single argument will determine whether or not meta values are returned in an array or not. For example: // If I set single to false, or ...
0
votes
1answer
77 views

How to use json_decode a post_meta value? [duplicate]

I have used get_post_meta($post->ID) to get all custom fields for my post since I have many of htem. Some of them were checkbox values and var_dumping the variable gives me this array (size=1) 0 ...
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
4answers
2k views

Get YouTube video id from url in a custom field

Here's the scenario, I have a site with thousands of YouTube video posts which are stored in a custom field 'video_url' which is being used in a custom video player. The custom player I'm using now ...
1
vote
0answers
44 views

Default Custom Field Value Automatically Update

I have created a hidden custom field with a php function as its value. Like so -- $value_rating = get_post_meta($Property_Id, 'vr', true); <input type="hidden" name="vr" class="form-control ...
0
votes
1answer
36 views

get_post_meta with related user

When I call post with get_post_meta I get all posts.I would like to get related post from user when using get_post_meta. How would I achieve this? Example: If I am logged in as foo than I would like ...
0
votes
1answer
65 views

get_post_meta with variable

I’ve created a custom post type and a corresponding meta box for a site I’m developing. As there are several entries for similar 'products', some of the post metas repeat, albeit with a trailing ...
0
votes
1answer
50 views

Order a WP_Query by meta value where the value is an array

I have a WordPress custom query: $args = array( 'posts_per_page' => 2, 'meta_key' => 'pworks_popular_posts', 'paged' => $page_nr ); $query = new WP_Query($args); ...
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 ...
1
vote
3answers
231 views

Why does get_post_meta not work with the posts page?

Looking for a reason why get_post_meta() doesn't work with home.php. From my reading I understand that it's a template and not a post or page, per "Custom fields won't display on my blog page". The ...
0
votes
0answers
35 views

Display post_meta-by_key on product catalogue

I'm trying to display a custom field in my woocommerce bookshop catalogue. I have added the field "author" and I want to display it after the product title, and before the price. ...
0
votes
4answers
877 views

How to Echo Metadata Value in Currency Format

I have a Custom Post Type with a Metabox and an input Text field for adding "Price" to the posts. Now I would like to display the input value which can be like 49 or 59 like 49.00 or 59.00 so far I ...
0
votes
3answers
126 views

Get array of metakey in all posts

My posts contain a meta-field that holds an external id. I'm trying to create a function with a loop that goes through all posts and puts all the meta-keys in an array and returns this array. This ...
0
votes
0answers
101 views

Dynamically add text-field to a custom post

I have created a custom post called 'schedule'. In that I want a button, when user clicks on that new text-field should get added with name and all text field should have a same name.Also help me how ...
0
votes
1answer
22 views

CPT posts in drop downed in meta box on page doesn't return post ID

I have an issue with displaying ID of selected post. Could you guys help? thanks Function below add_action( 'add_meta_boxes', 'cd_meta_box_add' ); function cd_meta_box_add() { add_meta_box( ...
1
vote
1answer
163 views

get_post_meta causes database queries

I want to know why my site's search results are slow. I've used the excellent Debug Bar plugin, and found out that each search result causes 5 DB queries, of which 3 are SELECT meta_key (see below for ...
1
vote
1answer
437 views

Create a random unique 6 digit number as custom field for custom post type

I use the following function to create a random unique 6 digit number and save it in a custom post type meta field. I am unsure about the use of rewind_posts() inside a while loop. The idea is that ...
0
votes
3answers
2k views

get_post_meta in WP_Query

I'm doing a plugin to add likes to posts I want to create a table on a page in the plugin to show each post and the number of likes function my_plugin_options() { echo '<p>Table of ...
0
votes
0answers
81 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 ...
2
votes
1answer
158 views

How to hide meta box values from custom fields list?

I have created a metabox : function drama_description_metabox_markup() { global $post; $drama_description_metabox_markup = get_post_meta( $post->ID, 'drama_description', true ); ?> ...
0
votes
1answer
125 views

Meta box data is saved but NOT displayed in the meta box text field. Why?

I have a custom post type and I created it using the following code. /* DRAMAS */ register_post_type('dramas', array( 'label' => 'Dramas', 'show_ui' => true, 'supports' => ...
0
votes
1answer
89 views

How to call a post's metadata in shortcode.php?

I'm not a terribly advanced WordPress developer, but I can kind of futz my way into a solution most of the time. This time, no such luck: I'm trying to write a shortcode to display a custom post type ...
0
votes
0answers
69 views

How can I get the $key / $value pairs of custom fields that were added via 3rd party plugins or themes?

I'm running WP Job Manager plugin which is designed to allow its custom post type fields to be altered within a theme or plugin via custom filters. I have added my own custom fields (example) and the ...
0
votes
0answers
133 views

get_post_meta($post->ID) returns empty string when in preview mode of custom post type

I've got my custom post type 'event'. I got tne next code in single-event.php: get_header(); the_post(); echo '<pre>'; echo "$post->ID\n"; var_dump(get_post_meta($post->ID)); echo ...
-1
votes
1answer
97 views

Access post meta just after publishing

the following code is supposed to store post meta of the recently published post to the variable $temp. But it doesn't, $temp is always empty. This seems to happen because "transition_post_status" ...
-1
votes
1answer
44 views

Automatically add custom taxonomy when meta value gets to a set number or beyond

Is it possible to add a custom taxonomy to a post when a meta value gets to a set number? Im trying to get it so once my post_views_count gets to 150+ it then gets the custom taxonomy trending added ...
0
votes
4answers
184 views

Remove href tag from wp_postmeta in 34,000 posts?

I'm using Godaddy Hosting, PHP 5, and Wordpress 4.2.1 I have 34,000 + posts that need outdated href tags removed. I am able to remove tags, one post at a time, by using this code in a page template ...
0
votes
1answer
128 views

Display Data From This Custom Media Upload Meta Box?

This plugin is working without any issue on CMS. Now I need to know how to properly display them in my post. Custom Media Upload Meta Box Plugin. $meta_box_media_upload = new ...
0
votes
1answer
80 views

Display post meta conditionally based on it's value

I have a custom field that's a radio button with 3 choices (yes, no, other). What I'd like to do is the following: [If custom field value is yes] Display something here [elseIf custom field value ...
0
votes
0answers
87 views

global $post object contains the wrong post

I'm using Bridge theme from QodeInteractive. This morning, all of a sudden, all my preferences from a page were gone. Preferences are saved as meta to the corresponding page. On debugging, I found ...
0
votes
2answers
619 views

how to get a list of meta data fields assocaited with a custom post type

I am using a theme which has defined a custom post type-- Now, I am trying to retrieve the list of metadata fields used by that post type-- so that I can insert data via PHP code in form of that ...
0
votes
1answer
592 views

get_post_meta not extracting title,permalink and posttype

i need to extract the post_type, title of the post and the permalink using get_post_meta i am trying following code for the same $title=get_post_meta($post_id,'title',true); ...
3
votes
1answer
253 views

How can I display image metadata?

I'm trying to add a filter to the_content that will find all images in the post and append the custom attachment metadata credit to it. Here's the functions I've have: Adds the Credit field to ...
0
votes
1answer
245 views

Get $post->ID from a URL

I have a custom post type called music. I have created a custom template as a normal page to show some stats for the musicians. I have a page where they can see all there songs and have added a ...
0
votes
1answer
485 views

How to check if user meta field is empty in conditional else statement

Hello all I have a custom post type set up for my wordpress site within this custom post type i have a meta box with about 11 meta fields that I have added programatically. What I would like to do is ...
-1
votes
1answer
268 views

How can I display my meta value in a textarea? [closed]

I have this saved: $description = get_post_meta( $postID, 'video_desc', true ); and then have used this in my form in textarea: value="<?php echo $description; ?>" When I check the ...
0
votes
2answers
378 views

get_post_meta as a list for drop down search filter

I was wondering if someone could help me out. I would like to create a dropdown search filter for my wordpress site. I would like the drop downs to be populated by meta_boxes values which i have for a ...