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

learn more… | top users | synonyms

1
vote
1answer
198 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
374 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
452 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
301 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
33 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
44 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
31 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
56 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
2answers
94 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
289 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
77 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
436 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
368 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
265 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
109 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
153 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
349 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
233 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
615 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
288 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
64 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
465 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
395 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
230 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
456 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
458 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
207 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
422 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
243 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
390 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
353 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
1k 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
372 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
209 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
530 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
302 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
704 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( ...
1
vote
2answers
186 views

How to find time last viewed?

I want to run an update script on pages that haven't been viewed and updated within X days. I'm using post meta to cache some related RSS feed data, and I want it updated once a week or two, but only ...
1
vote
1answer
152 views

Routine to convert custom post meta from old to new value

I have two custom post meta objects that have been applied to all pages and posts in my sites. The names are MyCustomHeader and MyCustomTitle and I have one of these assigned to each post and page in ...
1
vote
2answers
4k views

Strategy to get post meta for use outside the loop

I need to know solutions for the question above. There are cases, when we need post meta information outside the loop. Let's say, I'm developing theme that will display ads from certain vendor on that ...
1
vote
1answer
51 views

Problem With Order Item Meta In Woocommerce

I'm following Xatic's tutorial to help me add custom data to products. I've managed to be able to have that data on the cart page. However, it doesn't display in the order page in the admin backend. ...
1
vote
0answers
19 views

Custom RSS Feeds & Post Meta Data

Rss feeds normally display media files along with post excerpts. I am using post meta to add media files to a post. Unfortunately, since the audio file is not being inserted into the main textarea the ...
1
vote
1answer
26 views

Permalink structure with $_SESSION variables

I have a project that has content being filtered throughout the site (many custom WP_QUERY calls). Originally there was no URL needs, just filtering by $_SESSION variable. Works perfectly, but NOW ...
1
vote
0answers
29 views

echo a specific meta_key queried through a custom post

I'm new to coding but love tinkering around (on Virtual Server) with bits to upgrade my current website when I have the time. What would be really useful to me would be to post an individual ...