Post meta is a data set containing additional core as well as custom post information.

learn more… | top users | synonyms

1
vote
1answer
451 views

IF.. post meta show… Conditional Tag Help…?

I have the following conditional tag, which a friend helped me with... Currently it works doing.. 1) If a featured image just show that. 2) If images attached show featured image wrapped in a link ...
1
vote
1answer
333 views

orderby in custom WP Query does not work

I have this query: $new = new WP_Query(array('post_type'=>'support','order'=>'DESC', 'meta_key'=>'post_views_count', 'orderby'=> 'meta_value_num', 'posts_per_page'=>'20')); the ...
1
vote
1answer
583 views

Custom Post Type: Set post_title equal to a custom post type field

I’ve created a custom post type for employees in a company with some fields they have to fill (like E-mail, phone, etc.) and a select box which takes some values from another custom post type called ...
1
vote
1answer
200 views

Metadata Query when storing data as array possible?

Suppose I store all my post meta data in an array like $meta = array( 'img' => '', 'caption' => '' ); update_post_meta($post->ID, 'theme_banner', $meta); Can I query posts where ...
1
vote
1answer
384 views

Is there a need for nonce with Post Metabox?

I looking at the docs for add_meta_box. They used a nonce. wp_nonce_field( plugin_basename( __FILE__ ), 'myplugin_noncename' ); I am wondering, probably the save post form itself should already ...
1
vote
2answers
492 views

delete post meta from db, even if does not exist?

it is not the first i see that we "delete" a post meta even if it does not exist : example : $count = get_post_meta($postID, $count_key, true); if($count==''){ $count = 0; ...
1
vote
1answer
320 views

Populate Custom Fields in a Custom Post Type?

I want to set up a basic 'post rating' system for my site - I don't want to use a plugin - so I want to add the custom field 'rating' to each new custom post and populate this field with the number 1. ...
1
vote
1answer
47 views

How do you handle postmeta in admin area?

I've a bunch of techniques to add some information in admin area for users. For that I use WordPress APIs and meta boxes. Ok it's cool but what if I want to display information that are set with the ...
1
vote
2answers
164 views

Update meta values with AJAX

I am working on a voting system in Wordpress. I first made it with GET requests but someone told me you should not use GET for this, So I started working with AJAX to update custom fields/meta values, ...
1
vote
3answers
62 views

get_*_meta doesn't always return an array

I find it annoying that functions like get_user_meta or get_post_meta will return an array if the meta key exists or false if it doesn't. This means I need to do a check like so: $meta = ...
1
vote
1answer
91 views

populate post meta in gravity forms [closed]

I can populate post author email with this code: add_filter('gform_field_value_author_email', 'populate_post_author_email'); function populate_post_author_email($value){ global $post; ...
1
vote
1answer
778 views

update_post_meta() whenever custom post type is updated

I need the following functionality. Whenever my custom post type is updated or saved I need to overwrite certain custom post metas. I need to make sure this only affects posts of the post type ...
1
vote
2answers
129 views

Custom Post Types. Are there any disadvantages/advantages in using a plugin to develop them?

There are a few plugins which can assist you in building your CPT's, and these can usually handle your taxonomies and sometimes postmeta also. Some even take it further than that. I know that as with ...
1
vote
1answer
441 views

Create digital-virtual-downloadable WooCommerce products from the frontend using Gravity Forms?

A little background about my issue: I'm running WP + WooCommerce + Gravity Forms and want to enable users to create WC digital-virtual-downloadable products from the frontend using GF. Essentially, ...
1
vote
1answer
666 views

Custom fields to save multiple values

I’m adding custom meta-box, by means of jquery I can create in it several custom fields with a key “test”. There can be one or several custom fields, but the key is only “test”. I can also delete key ...
1
vote
1answer
88 views

Get posts between custom dates

I created an event CPT and a meta box with a date. I saved the date as post_meta in the form dd.mm.yyyy. Now I want to create a shortcode that queries all posts which's dates meet the condition ...
1
vote
1answer
596 views

filtering custom post types via meta data drop down

I'm trying to add drop down filters (that are populated by terms that are in use) to a custom search page for "opportunities" or listings page. Currently I am doing this with taxonomies but doing this ...
1
vote
1answer
571 views

How do I retrieve multi-dimensional arrays from the wp_postmeta table, & display on a website?

I would like to retrieve multi-dimensional arrays (that have been created with metaboxes), & display them on the front end of a website using shortcodes. My Question: How do I retrieve ...
1
vote
1answer
586 views

Select from wp_post and multiple meta_value from wp_postmeta

My lack of SQL skills has stopped me in my tracks here. I'm trying to select post_id, post_title and two postmeta values - the first has the meta_key of 'search_country' and the second a meta_key of ...
1
vote
1answer
320 views

How to add a new meta key and assign timestamp to posts

I've been trying to look for a way to create a loop in my website and show posts being read/watched but have not found anything. The only way I can accomplish this would be to create a new meta key ...
1
vote
1answer
135 views

Multiplicate entry on update_post_meta

I have a metabox with an array of input: <input type="text" name="activite_dates[]" size="30" /><br /> <input type="text" name="activite_dates[]" size="30" /><br /> <input ...
1
vote
2answers
2k views

Repeatable custom meta fields

I am working on creating custom meta boxes for the back-end of WordPress. I would like to add a metabox with several fields, in my case an image upload and a text input, but with a button that can ...
1
vote
1answer
187 views

Job of meta_key meta_value fields in database tables

I'm researching the structure of WordPress database and there is something that really get me confuesd. Could someone please explain, what is the exact job of meta_key and meta_value fields in ...
1
vote
1answer
642 views

How to implement a Google map store locator

I have followed the following Google developer doc about creating a store locator usng PHP & MySql. https://developers.google.com/maps/articles/phpsqlsearch_v3 I have this working but now I ...
1
vote
1answer
406 views

is there a way to show the the post title after the image?

Trying to show the post title after the image in the main blog page and single page, I have tried to edit the content.php but unable to achive the result I need, which is basiscally IMAGE TITLE META ...
1
vote
1answer
247 views

Get Metakey value while saving post

I am trying to insert metakey value while saving or updating post but somehow it is not inserting metavalue to link column of my custom talbe called wp_banner_views function ...
1
vote
1answer
738 views

Change slug with custom field

I want to change the slug of a post with a custom field. In example, if the custom field is "keyword" my post link will become: mysite.com/keyword. If the custom field is empty, i want to generate a ...
1
vote
1answer
321 views

Saving value of a selection option in comment form as comment meta

In a plugin that I am writing I need to let user choose an option from a dropdown list before they post a comment. I used the comment_form action and inserted a drop down into the comment form. /** ...
1
vote
1answer
66 views

How to add “time” data this?

I am using this simple snippets to get post view count for a long time I was wondering if we can add a "time" data ? Because I would like to show the view of yesterday/ 2 days ago / 2 days ago etc... ...
1
vote
1answer
628 views

Get aggregate list of all custom fields for entire blog

So, like the title says, I'd like a single function to get an aggregate list of all custom fields, site-wide (all posts, pages, CPT's). Normally, I do this with a couple SQL statements and juggle the ...
1
vote
2answers
2k views

How do I use wp_query for WordPress search?

I would like to create a custom search form to search posts based on the values of about 4 custom fields. I tried using wp_query to achieve this but so far my biggest problem is that the I don't get ...
1
vote
1answer
431 views

If meta key exists in get posts function otherwise create it

The following code fetches posts with the meta key home telephone numbers. $metas = ''; $args = array( 'numberposts' => 1, 'post_type' => 'electors', 'orderby' => ...
1
vote
1answer
248 views

Generate multiple goo.gl shortlinks for qtranslate bilingual blog

I'm working on revamping my personal blog with a custom built theme and making it bilingual with the help of qtranslate. I've gotten to a grinding halt when it comes to automatically generating the ...
1
vote
1answer
524 views

Add a Save Button to Custom Meta Box [duplicate]

Possible Duplicate: Adding submit or update button to custom metabox? I added a Meta Box Like So: add_action('add_meta_boxes', function() { add_meta_box('CNMeta', 'Custom MetaBox', ...
1
vote
1answer
519 views

Deleting Custom Posts & Meta Data on Uninstall

My uninstall.php file won't delete my custom posts and the meta data related to them on uninstall. The plugin files get deleted, but nothing from the database. If anyone is able to have a look at ...
1
vote
2answers
217 views

How much faster is a tax query than a meta query?

I'm building a portfolio post type and I want to have a way to mark certain pieces as featured, some as normal (default) and others as archived. The pieces would only ever be one of these 3. Because ...
1
vote
1answer
37 views

replacing the_autor or make callback

I'm looking a way tho change the the_author(); function in the loop, I have post meta data with the name of the user who posted. I need to do this: If the user is registered, show the_author();, ...
1
vote
1answer
442 views

Query_post($args)

it is possible to use a array by the this query? This Version doesnt work: $args = array( 'order' => 'ASC', 'meta_key => array('city_1','city_2), 'meta_value' => ...
1
vote
1answer
268 views

Custom field not updating when value is empty

I've added a few custom fields to the WordPress image uploader using the hooks attachment_fields_to_edit and attachment_fields_to_save. Everything works very well, except when a field is erased by the ...
1
vote
1answer
433 views

MySQL Query To Select Post By Postmeta

I have two custom post types, type1 and type2. Type2 posts have a postmeta called postID that is the ID number of a post in type1. When showing type1 in single.php I want a mysql query that selects ...
1
vote
1answer
2k views

Is it possible to store arrays in a custom field?

If I understand correctly, custom fields work like this: key(string/int) => value(string/int) Is it possible to define a custom field like this? key(string/int) => value(array (string/int, ...
1
vote
3answers
2k views

Custom URl parameter

i have Wp blog that need to receive a custom paramter on category page for filter the posts like my rule. For example: http://mysite.com/category/teste?myvar=ABC How can I get the myvar from ...
1
vote
1answer
366 views

Display All Custom Post Fields and Values, Unless Empty

I am looking to grab all of the custom post meta fields for a given post and display them on the page which i have accomplished with the following code. However I would like to check if( !empty() ) ...
1
vote
1answer
2k views

How to store post meta in an array?

What is the best way to store post meta in an array (using a custom write box, know how to do that) so that all post meta is in a single custom field?
1
vote
1answer
398 views

Trigger “unsaved changes” dialog for custom post meta changes

I'm using a custom post type with custom meta fields, but autosave and the "unsaved changes" dialog don't seem to be triggered for these custom meta fields. Autosave isn't as important to me as the ...
1
vote
1answer
210 views

Post image in WordPress not appearing on home page

I just installed WordPress and I'm trying to set a image to every post I have. I did this: Custom fields ----name: paddimage-gallery --value: URL of image. I go to my home page and it does not ...
1
vote
1answer
583 views

Access post meta in future_to_publish function

Why am I having trouble accessing post meta data in a future_to_publish add action in functions.php? I have tried: function post_to_twitter() { global $post; $url = ...
1
vote
1answer
308 views

Move Post to different category if post_meta field is 0 or is 2 days old?

Is it possible to move a post to an another category if post_meta field is 0 ? I'm building a reverse order vote, every post have by default 10 votes and after a user vote, removes one vote by ...
1
vote
1answer
708 views

query_posts() on key's value, or key's existence

I recently started using simple fields on a project to differentiate between types of posts. All posts from now on will have one of four possible meta values associated with this (Story, Article, ...
1
vote
1answer
2k views

meta_compare seems to be treating values as strings instead of integers as expected

Trying to use meta_compare as suggested in the codex: query_posts('meta_key=miles&meta_compare=<=&meta_value=22'); Here is my code: global $wp_query; query_posts( array_merge( ...