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
21 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
19 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 ...
0
votes
2answers
366 views

Click on featured image to pull up lightbox

So I have a gallery-like archives page full of donors on my site. Each box of the gallery consists of a featured image from the donors post type. The goal for the site is, upon clicking a donor, to ...
-2
votes
1answer
348 views

echo is just displaying the word 'array', rather than the array [closed]

I'm trying to see the structure of an array, but when I try to echo the array, all it says is 'array'. Please can someone explain how I can see the structure of an array? add_shortcode('book', ...
1
vote
1answer
22 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
19 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
27 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
50 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 ...
0
votes
0answers
16 views

How can I get the open graph thumbnail url?

I use WP SEO plugin to set the Open graph image meta, because my template does not support featured image thumbnails. Now I want to use the YARPP related posts plugin which uses featured image ...
0
votes
2answers
50 views

Displaying values from related field - if empty shows current post type's link and title

I'm working with custom post types. In the post type awards I have a relationship field that links each award to a post from the post type project. I'm using the following code to return the values ...
1
vote
1answer
56 views

get_post_meta doesn't work

I created a custom meta box inside a page but I can't display the content! I'm inside the loop and here there is the code of my functions.php: $meta_box['portfolio'] = array( 'id' => ...
0
votes
2answers
1k views

if get_post_meta is empty do something

I need opposite of this: <?php if ( get_post_meta($post->ID, 'price_list_category1', true) ) : ?>style="display:none;"<?php endif; ?> In other words I want style="display:none;" ...
0
votes
1answer
95 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
50 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
38 views

Difficultly changing date format in post meta value

I have a custom post type with a custom field that takes a date. The posts are later ordered by the date in that custom field. Unfortuately I formatted the date incorrectly and there are already a ...
0
votes
1answer
44 views

How can I get some of a posts meta data whilst it is still inserting?

I'm trying to make a function where a child post of a certain post type inherits the same title and slug as its parent. I'm using WP Types to define my post types and their relationships. But I'm ...
1
vote
1answer
57 views

Custom Meta box only returns most recent value on page

I created a custom post type and a custom meta box where I create a new post and input a Youtube URL into the meta box, and I call for it on a custom template page inside an iframe that is inside in ...
0
votes
0answers
216 views

How to add fields to _wp_attachment_metadata?

I'm developing a custom metabox with the possibility to upload images and give the user the possibility of deciding whether those images are to be displayed on the front end or not, instead of having ...
0
votes
0answers
30 views

Get_post_meta returns Array instead of actual value [duplicate]

With the PODS plugin in Wordpress, I've created a custom post type called project. Within project I've created a few custom fields. One of those is project_thumb. The thing is; When I want to display ...
-1
votes
1answer
33 views

delete blank space in post_meta empty [closed]

Like title said. I need delete blank space when post_meta don't have value. Code example: <?php global $wp_query; $postid = $wp_query->post->ID; $meta = get_post_meta($postid, 'direccion', ...
0
votes
1answer
29 views

get_post_meta inside echo [closed]

I have a serious problem :) I have this code: <?php global $wp_query; $postid = $wp_query->post->ID; echo get_post_meta($postid, 'provinciadestacada', true); ?> And i want include ...
0
votes
1answer
26 views

delete value 0 in post meta [closed]

I have a simple question. I have this code and its correct, <?php global $wp_query; $postid = $wp_query->post->ID; $meta = get_post_meta($postid, 'codigopostal', true); if($meta != $empty) { ...
0
votes
1answer
41 views

Get post_meta of children and compare to current page ID

I am stumped on a bit of php code in my template. I have a custom field named "services" with a value such as "2402, 2366, 78" These are page ID's. In my template I want to do the following: Get any ...
0
votes
2answers
121 views

Trying to get property of non-object error using get_post_meta()

I made a simple function for post_meta, in functions.php: // Top Sub Heading (top_sub) FROM CUSTOM FIELD function topSub( $Trunckvalue = null ) { global $post; $TopSub = get_post_meta( ...
0
votes
1answer
56 views

If metabox has content display content

I know how to display field content if the field has content. $monday = get_post_meta($post->ID, '_cmb_open_monday', true); if ( ! empty ( $monday ) ) { echo 'content'; } How do I display ...
1
vote
5answers
717 views

Get meta_id along with meta_key and meta_value

Is it somehow possible to get_post_meta or get_post_custom and have meta_id returned along with the meta_value? For example: $data = get_post_meta( $post_id, 'my_key' ); // returns this: array( 0 ...
0
votes
1answer
26 views

Display articles related to a custom field on a page

I have a little problem to display some articles related to a parent page. I explain. On the first hand I have a page with a model template. On the wordpress editor part, I create a custom meta field ...
0
votes
1answer
89 views

Trying to get file name

I have a custom meta box to store pdf files. For this input, I'm using type="media" to acess wordpress media library. Now I can't get the file name. Here is my entire loop: <ul> ...
1
vote
0answers
202 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
1answer
45 views

Display Post Meta in Header

I'm trying to get page post meta in my header so I can set some meta tags. I tried to get the global post variable but it only return true. <?php global $post; global $wp_query; echo ...
0
votes
1answer
68 views

Remove last character in get_post_meta

I have a custom field that contains a sentence along with a punctuation mark at the end. I am looking to use this field as a title of the article on my homepage, but in doing so I would like to remove ...
0
votes
0answers
82 views

Custom Field: Display only if a specific key is selected outside the loop

I might be doing this all wrong. I have a custom field called "enable_adsense" and the value can be either "yes" or "no" What I'm trying to do is display something if the value is "yes" and something ...
0
votes
1answer
28 views

Return only custom post types for the page, not all

I'm currently working my way through some custom posts (for the first time). I'm managing to return the bits I need using this <div class="pagered"> <h1 ...
0
votes
2answers
25 views

put saved metabox values back into fields and then display on the front end

i have a group of metaboxes which i finally are now saving but am struggling to get the saved values back into the input boxes they came from. so for example i have a meta field called link text and ...
-1
votes
1answer
107 views

get posts based on category and post meta

I am coding a Live Show box for a radio website to show who is on air and who is up next. I've been using the get_post function to retrieve posts based on the category (in this case the day of the ...
1
vote
2answers
87 views

Why is my get_post_meta always empty

I made this action hook which will send an email to the users every time a new post in the custom post type "events" is made. function email_members($post_id) { global $wpdb; $usersarray = ...
0
votes
1answer
97 views

get_post_meta is always empty when I use wp_mail

I made this action hook which will send an email to the users every time a new post in the custom post type "events" is made. function email_members($post_id) { global $wpdb; $usersarray = ...
0
votes
2answers
200 views

Where is the key _wp_page_template passed?

When adding custom post meta boxes, I understand that whatever name attribute input you put would be passed through the form into the server. Hence, if I have <input type="text" ...
0
votes
0answers
167 views

loop through custom post types with meta data

I'm really curious as to how might be the quickest way to loop through a custom post type with meta data. I have some code that works but it's slow. I'm using wp_query and it works. I have also a ...
0
votes
0answers
37 views

Displaying additional meta from a custom post type on the page?

I have added the custom field which displays in the custom post type "portfolio" just fine. // Add more custom field function woo_metaboxes_add($woo_metaboxes) { // Check for post type = ...
0
votes
1answer
76 views

how to fire join query with post_meta

I have print sql query that runs within 'posts_where' filter and its like: SELECT wp_posts.* FROM wp_posts WHERE 1=1 AND wp_posts.post_type = 'shop_order' AND post_date >= '2013-08-26' AND ...
0
votes
2answers
3k views

How to get meta box data to display on a page

I am trying to piece together a Metabox with 3 text editor fields for a custom post type. The box is showing up and appears to be saving on the custom post type entries but I can't get the data to ...
1
vote
1answer
337 views

How to display Yoast SEO meta description in archive template for each post instead of the_excerpt()?

I read this question but it wasn't what I was looking for exactly. I'm new to Wordpress and a little confuse with the functions and everything. How can I get the metadescription in the loop for each ...
0
votes
1answer
151 views

Image not showing using a custom function and get_post_meta

I'm trying to create a function to display either a theme option or custom images based on user input. So basically, it's a custom meta box. The user selects either a display header image OR they can ...
0
votes
1answer
2k views

Display Custom Meta Box Field Only If Value is Present

I'm messing around with Custom Meta Boxes in WP for the first time and was wondering how I go about displaying the fields that only have values attached to it. For example I've got a meta box with an ...
0
votes
1answer
138 views

How do I save each option in a multiple select menu as it's own meta_key + meta_value pair?

How do I save each option in a multiple select menu as it's own meta_key + meta_value pair? This is the basic multiple select menu. Note: multiple select menus allow you to select more than one ...
0
votes
2answers
171 views

Multiple If else statements on Search Result Page

Ok, I have a few CPT's setup with a metabox that only requires some values for some categories. When searching a specific category, I want to display a link to the value (which is a url) if it exists ...
0
votes
1answer
122 views

Related posts and custom meta_box?

I am trying to code the ability to pick which posts should be included as related to the current post the user is editing. I have used @MikeSchinkel very helpfull post here, to include a list of ...
0
votes
0answers
8 views

WP Oembed Youtube URL From Custom Field With AutoPlay & Height Set [duplicate]

I already know how to get wp_oembed_get to display a YouTube video URL from a custom field via get_post_meta but where I'm having trouble, is getting things like autoplay, width, height get passed to ...
0
votes
0answers
431 views

Update Post Meta for Arrays — Remove/Replace Single Value from Multi Dimensional Array

I am trying to unset/remove then replace/update a single value from a post meta field, but my code for array_push() and unset() are removing all of the values from each array. Here are the two halves ...