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
14 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
26 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
19 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
19 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
1answer
33 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
50 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
49 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
64 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
42 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
73 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 ...
0
votes
1answer
33 views

Get all the posts where meta field with multiple choice has several values checked

I apologize beforehand for any confusion, I'm just 2 days with WP. So, I use Advanced Custom Fields to add formatable custom fields to posts of partucular type. One of fields is checkboxes with ...
0
votes
0answers
19 views

How do I take the first picture?

Custom fields first picture taking multiple pictures? // Meta Bilgileri $page_images = get_post_meta( get_the_ID(), 'emlak_galeri', true ); while ( have_posts() ) : the_post(); // Post Slider ...
0
votes
0answers
84 views

Define category ID using get_post_meta

I need to define the Category ID in my singles page through custom fields so that i can load a different category depending on the page. This is what i have so far and its not working. Any help would ...
0
votes
0answers
31 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
73 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
54 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
46 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
0answers
25 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 ...
-1
votes
1answer
41 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
24 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
62 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
16 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
306 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
87 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
43 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' ...
0
votes
0answers
24 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
3answers
562 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
163 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
88 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
45 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
124 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 ...
1
vote
1answer
80 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
132 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
68 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
25 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
1answer
51 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 ); ...
0
votes
2answers
164 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
130 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
111 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
260 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
116 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
32 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
181 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 ...
3
votes
3answers
383 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
244 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
429 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
42 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
626 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
58 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
186 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 ...