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
18 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
14 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
14 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
0answers
12 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
31 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
23 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
36 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
24 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
36 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
17 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
61 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 ...
2
votes
2answers
61 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
61 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
54 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
20 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
155 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
43 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
63 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
0answers
41 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
190 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
55 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
74 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
41 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
106 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 ...
0
votes
0answers
21 views

Accessing post_meta on save of new post

I am trying to get the value of a post_meta when the post is published. The problem is that all I can get is the post ID, but the post_meta must not yet be in the database when I make the query. I do ...
0
votes
1answer
54 views

get_post_meta() empty in preview WHEN custom post is published

So my client managed to find some (bug?), when custom post is published and he previews post all information what is posted with custom meta boxes is inaccessible. When I started debugging I found ...
0
votes
1answer
92 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 ...
0
votes
1answer
28 views

Adding custom fields to images

I want to show sources under my every images. So basicly I want to add a simple custom field. I added this code to my function.php add_filter('attachment_fields_to_edit', 'edit_media_custom_field', ...
0
votes
0answers
66 views

How to save dynamically generated value in post type?

I'm trying to use the count of the amount of people that register a post id to a table in the DB. I want to save this COUNT value to the post_meta so when I display the list of posts it can also show ...
0
votes
0answers
544 views

get url image of custom field with custom size - get_post_meta, wp_get_attachment_image_src

I use a custom WP_Query to load image and other information from custom post type event to supersized.js script. This query get all custom post type event with custom field wpcf-img-event not empty ...
-1
votes
1answer
157 views

Display post's description and caption

I am trying to get and display 5 featured posts. To achieve this target I have an offset of 5 recent posts. I have successfully fetched the posts' id's and images, but I failed to get every post's ...
0
votes
1answer
32 views

Can't Output get_post_meta?

I have a custom field for my post and I am trying to output it onto my post's page but nothing appears. I know my code works otherwise if instead of trying to call my custom field, I use a fixed ...
0
votes
0answers
57 views

Use custom field “date” compared to today's date to display & order post list

I am at a loss here. I have a custom meta field blser_date where the client can use the date picker. The meta field is setup in a meta box array (this may be an issue b/c of the key?) Here is the full ...
0
votes
1answer
58 views

get_post_meta slowing down my page load (in a plugin)

I've been working on this project where I need to load events (custom post type) and a whole bunch of meta data for every event. The problem is that page loading times are getting longer and longer ...
0
votes
2answers
122 views

User function to return multiple get_post_meta()

I am trying pass a WP function to a user function, where I can pass a new func argument $key for each post_meta type here: functions.php function my_post_meta($key){ $meta = ...
0
votes
1answer
70 views

Hide H1 Title using the_title filter

I am trying to hide the pages H1 header IF a custom field specifies this. On a page back end I have added a custom field: Name = hide_title Value = true I then want to hide only the H1 using a ...
0
votes
2answers
149 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
1answer
466 views

Meta Data for Custom Post Type not saving

I'm in the process of building a custom plugin, and I'm having trouble saving meta data for the custom post type. The boxes display correctly in the editor, but when I click Publish or Save Draft, the ...
0
votes
0answers
732 views

Where should get_post_meta() go to get $post->ID get_post_meta() is empty and $post->ID & get_the_id() are working

EDIT: So I added the full code. What I'm trying to attempt is to get the post id into the metabox values for a publish immediate and scheduled post. It appears that I'm having trouble passing the id ...
0
votes
1answer
123 views

get_post_meta is returning image id

I'm using this script to get image filename, stored in a custom meta called background: $background = get_post_meta( '22', 'background', true ); echo $background; But it is returning the id of the ...
0
votes
2answers
70 views

Setting Post Title via Meta Data returns Auto-draft

I've read here and other places about setting a post's title based on it's metadata. Unfortunately I'm unable to get it working and I'm hoping someone else can point me in the proper direction or ...
0
votes
2answers
151 views

get_post_meta with WP_query

I know this is a convoluted loop (inherited from someone else), and this must be pretty simple: the_permalink and the_title display OK, but why doesn't my post meta eventdatestart echo?. <?php ...
0
votes
0answers
60 views

Getting meta content from get_next_post & get_previous_post

Is it possible to retrieve meta content for the get_next_post() and get_previous_post()? I'm currently using the following method, but not having much luck: <?php $prev_post = ...
0
votes
1answer
29 views

Check whether attachment ID is associated with more than one post?

Is there a function to check whether an attachment ID (=get_post_thumbnail_id(..)) is associated with more than one post? With "associated" I mean that a posts's meta value for the meta_key ...
0
votes
1answer
407 views

Showing Meta Data for Custom Post Types?

I'm busy learning some basics behind Wordpress development and so far I'm getting on quite well. However, I've hit a stumbling block. Firstly, my test site is; http://popcorn.canny-creative.com And, ...
0
votes
2answers
423 views

Get meta value and associated user meta

I'm working on a site where users are able to publish posts with custom fields associated with them. I want to display meta values from all posts, and include which user created the post where the ...
1
vote
1answer
288 views

How to count post meta key values for all posts in database

In my post meta data I have the following 'key' for every post: "image_details" a typical value of which is an array such as: ...
0
votes
0answers
38 views

search page id issue

I have a little issue with something i working at. I have a notice on 404 pages and on search page when i try to find something that do not exists. Notice: Trying to get property of non-object in ...
-1
votes
1answer
62 views

Colecting values from custom field checkboxes and displaying them in the post

Ok, i have a form and a input fields type checkboxes. But in the post appears only the last value, what can be the reason? <label for="extras"> Extras </label> <input type="checkbox" ...
0
votes
0answers
325 views

Humanmade | Custom meta box class: How to display a repeatable meta box group?

I'm using the Humanmade | Custom meta box class to add meta boxes to my themes admin pages. I have integrated the class and have been enjoying the use of adding meta box's to my current projects ...