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
0answers
4 views

I am trying to add custom-fields to a post carousel plugin

I have a post carousel on my website.I am trying to add an option to display custom fields. I looked at the code for the carousel and I tried to add my custom-fields option. I am not getting a display ...
0
votes
1answer
23 views

Save Metabox Custom Field Value

I am using this code to show post type dropdown to select available post types but when i submit the post it restores the value back to post, how can i make sure it saves it? <select ...
0
votes
1answer
16 views

How to get_post_meta in a shortcode in excerpt on archive pages

I have a shortcode, [foo], which displays the value in a custom field. However, as it appears near the top of each post, it is included in the excerpt. function foo_shortcode(){ global $post; ...
0
votes
1answer
15 views

String taken from database table post_meta is showing HTML tags on Frontend

I have saved a string in post_meta table in wordpress database with html entities like- <p>Hello <b>Shashank</b>, I have an idea.</p> When I get this string on frontend using ...
0
votes
3answers
352 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
1answer
322 views

Custom meta field don't give me numerical value

I'm trying to use the jquery plugin Timeago. With this, I want to countdown from a date (2013/03/04 format) Which is in a custom field. Echo $Begin2 gives me something like : 34 days ago. It's work ...
0
votes
0answers
17 views

Performace on 1 million plus meta fields vs 1 field with 1 million multi array

We are potentially looking into building a counter in a post_type. So a post meta field wil be created with some data like total downloads and downloads left (tied to user ID). We expect up to one ...
2
votes
2answers
853 views

How to hook a filter to catch get_post_meta when alternate a custom field output?

How to hook a filter to catch get_post_meta when alternate a custom field output? I have fill a custom field(meta data) in a post, just like this: <!--:de-->Nominale ...
0
votes
0answers
29 views

get_post_meta not working online in plugin [closed]

I am using the latest version of WooCommerce Quick/Bulk Order Form where I've added 2 custom fields, packaging type and quantity in package, to be displayed for variations/single products. The issue ...
4
votes
2answers
5k views

Display Yoast WordPress SEO title in archive template

The WordPress SEO plugin by Yoast allows users to add SEO titles and meta descriptions to taxonomy term archive pages. These are then used in the head of the document. I´m trying to display the SEO ...
-1
votes
1answer
28 views

Parse error thrown by get_post_meta [closed]

in a custom plugin I am developing, I am getting this error as soon as I activate the plugin: Parse error: syntax error, unexpected '[' in ...
0
votes
0answers
15 views

Get metadata of all files in the media

I need to retrieve metadata of files that are not images such as word, excel or pdf documents. I tried using get_post_meta( $post_id ); and wp_get_attachment_metadata( $attachment_id ); I'm only ...
0
votes
1answer
38 views

esc_attr on get_post_meta [closed]

Simple question, I see that some themes are using esc_attr or esc_html and url after they define varible with get_post_meta, while others are using it during variable definition. What would be best ...
0
votes
0answers
14 views

Populate field on submission via edit page

I've got a events listing plugin which I need to modify slightly. When adding an event via the edit / new page in admin the event date is split into 3 parts, like so: ente$meta_box_events = array( ...
0
votes
1answer
50 views

How to get single value from get_post_meta() array of values?

I'm trying to customize a plugin to check the current user's IP against previous IP values collected and stored by the plugin. The plugin collects user votes for a custom post type called ...
0
votes
1answer
36 views

If ACF meta_key has meta_value

I have an ACF field (options) that contains a list of options: Blue Red Green I would like to echo the option selected, ie: if(get_field('blue') == true) { echo "You have selected the color ...
0
votes
0answers
34 views

get_post_meta doesn't work with variable

The $event_count variable doesn't prints anything, what am i doing wrong? global $post; $event_count = get_post_meta($post->ID, 'eab_event-bp-group_event', true); $args = array( 'post_type' ...
3
votes
3answers
189 views

Custom post meta field effect on the performance on the post

I have the posts which have many custom defined meta fields. On posts I am calling them on requirement using get_post_meta. Means for 10 meta fields I am using it 10 times. Am I doing it right? ...
0
votes
0answers
19 views

Get Custom fields from PAGE in POSTs

I've a simple problem but i don't know how fix. I create custom fields from my web, i use this to generate something style in the header. The header its same in example.com/taxonomy and ...
0
votes
1answer
288 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 ...
0
votes
3answers
187 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
1answer
62 views

Minimising Database Queries when using Advanced Custom Fields

I'm working on a page which lists staff members for a large company and trying to minimise the number of times I'm forced to query the database as it gets quite complex and slow. 'person' is a ...
0
votes
1answer
38 views

Add custom class to existing menu items from custom meta

I would like to add a custom class to my existing menu items. The problem is, that I would like to do something like this: <li class="<?php echo get_post_meta($post->ID, "_icon", true); ...
0
votes
1answer
61 views

Display get_post_meta if contains value

Am struggling to get the below to work. I just want to display the get_post_meta 'title_override_text' if it contains any value otherwise just display the standard title (already catered for in ...
0
votes
1answer
30 views

Editor meta box Showing but not saving

I am trying to create an editor meta box and I have been following tips found in other similar questions without luck in getting the meta box to save and display its content. The meta box shows but ...
0
votes
1answer
33 views

Why is variable that get_post_meta stored in empty?

I have used the following bit of code in another script on the same site, & it worked there. $this_post_id = get_the_ID(); $key_2_value = get_post_meta( $this_post_id, 'custom_select', true ); ...
1
vote
1answer
75 views

Echo page title from page with custom meta datetime picker

I am using Custom Metaboxes and Fields for Wordpress I am using the datetime_timestamp custom meta with a page. I am trying to echo the title of the page I am using the custom meta datetime in. But ...
0
votes
1answer
71 views

Order by in foreach

hello im getting post_id by using wpdb after that i wanna show postmeta(sd_l2) order by their value i uses this codes global $wpdb $top5_ov_performance = $wpdb->get_results("SELECT post_id FROM ...
0
votes
1answer
42 views

Piklist File Upload

I am doing this tutorial: https://piklist.com/user-guide/tutorials/displaying-images-upload-field/ After creating this for a custom post type: // Upload Image / File piklist('field', array( ...
0
votes
0answers
17 views

Create Featured images on the fly

The title is too short to descirbe what i want to accomplish so let me start. I have a custom type ('chesspuzzles') and I want to create the featured images on the fly (and use them in widgets too, ...
0
votes
2answers
97 views

How to echo value of a meta select box to the browser

I think I'm echoing the value of the selected option from my select meta box wrongly. Nothing is being shown in the browser. Functions.php : function add_custom_meta_box() { add_meta_box( ...
0
votes
1answer
77 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 ...
1
vote
1answer
71 views

Getting value from get_post_custom

I have added a custom meta box to a category that shows up fine. The only purpose of this metabox is to supply a link to the post. I can see that the box works because my test link is saved in the ...
0
votes
1answer
175 views

How can i get multi checkboxes value in metbox?

I make list of check boxes by WordPress meta-box and i can not get this value in my theme. i can get my text value with this code <? echo get_post_meta($post->ID, $prefix . 'text', true); ...
0
votes
0answers
92 views

get_post_meta() cannot return values from nested arrays

I apologize if this question was answered on here. I searched and could not find an answer that related to my own issue. I've been turning my wheels on this for three days now and am now seeking ...
0
votes
1answer
30 views

Related query shows same image in loop

I'm using the code below to query all other posts with same value in custom field FeaturedArtists. Works great except the images. All images are the same as the current post. If I change ...
1
vote
0answers
130 views

How to use pagination with get_post_meta

I have a Products Page that i am using to add products using custom metaboxes this is the code for my page <div class="container products"> <div class="row"> <?php ...
0
votes
0answers
192 views

Automatically add custom fields (post_meta) to all published posts, hourly, via wp_cron?

I'm trying to update the post meta of all published posts hourly (via wp_cron) with the code below: if ( ! wp_next_scheduled( 'postviews_updatedcounts_hourly_event' ) ) { wp_schedule_event( ...
-1
votes
1answer
148 views

How to echo get_post_meta (Fluent-Framework)

PHP beginner here. I purchased the Fluent-Framework plugin, which allows me to easily crease Post Types, Meta Boxes, and Option Pages within my theme. I am having trouble echoing the Meta Boxes, ...
0
votes
0answers
38 views

selected into metabox doesn't show up

I have been using the very known metabox switch code but something weird happens. In the metabox, only checked boxes have been saving. The selected field doesn't show up the selected option ...
0
votes
1answer
52 views

Howto: use existing post_meta as options for a different metabox (checkboxes or list)

I want to create an "Employee" Custom Post Type ("Add New Employee") wherein the employee may belong to one or many offices. The user needs to be able to add/edit/delete offices via a separate ...
0
votes
1answer
427 views

Display custom field meta outside loop, site wide

I've created a custom field ("breaking") with the goal that whenever one post has this field present, it will display the value in the header throughout the site (that is, all posts, pages, archives, ...
0
votes
1answer
123 views

Trying to write shortcode with get_post_meta but isn't working

I am trying to write a plugin with a CPT and have a shortcode to display the data. I can get 'the_title()' to work and display the title of the post type but using 'get_post_meta()' I can't seem to ...
0
votes
2answers
325 views

getting the post_id from the post_meta

I need to find out the post_id of a post_meta record where the custom key is 'XYZ' and the is 'ABC'? Is there an API for that? Or do I need to run a regular select SQL with wpdb class?
0
votes
0answers
64 views

get_post_meta Not Working After Moving The Second Custom Metabox to The Side

I got 3 custom metaboxes in my custom post type. The previous structure is like the following: Metabox 1 Metabox 2 Metabox 3 If the Metabox 2 is moved to the side, the Metabox 1 won't be able to ...
0
votes
1answer
248 views

Show value of select dropdown in meta box

I have created a meta box which has a select dropdown list and i want to show it in the post as a user selects a particular option from meta box.I cant figure it out how its done.Here is my meta box ...
0
votes
0answers
70 views

Getting attributes from custom_post input

I'm having custom field created like that: function woocommerce_form_field_numeric_2( $key, $args, $value = '' ) { global $woocommerce; $defaults = array( 'type' => 'number', 'label' => '', ...
0
votes
0answers
130 views

how to echo/display the custom field value in specific custom field name?

I have tried this code: <?php query_posts(array( 'meta_key' => 'custom_cat', 'meta_value' => 'creative', 'post_type' => 'page' )); ...
0
votes
0answers
46 views

Multiple meta data one label

I am wanting one label but multiple data to be under the label. I also want to reference each input option individually so that I can query for specific meta data. Currently I have, function ...
0
votes
1answer
260 views

Hide a div when a custom field is empty

I am having trouble hiding a div when the input of a custom field is empty. This is the code I am using but can not seem to get it to work. The field that displays the content is _cmb_fe_wysiwyg ...