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

learn more… | top users | synonyms

2
votes
3answers
2k views

Why time functions show invalid time zone when using 'c' time format?

These are the functions I use in my theme to display the "entry-meta" which includes published and last modified dates (among others) of an article: // Shows Author and Published Date if ( ! ...
2
votes
2answers
168 views

How to allow hidden custom fields to be added from wp-admin/post.php?

I know that using an underscore in front of a custom field name hides it from display on the front-end, e.g. _custom_field_name. In my experience, WordPress also prevents one from adding such a custom ...
2
votes
1answer
1k views

The “_encloseme” Meta-Key Conundrum

While working with metaboxes / custom fields I've seemed to indirectly create many of these _encloseme meta_keys all over my wp_postmeta. Seen here: So far no problems have arisen from this and ...
2
votes
3answers
4k views

WP_Query, custom sort and custom filter

Is it possible using WP_Query to return a filtered list of items based on the following criteria set? I seem to be struggling as there are numerous queries against custom fields. Select all posts ...
2
votes
3answers
427 views

How to access the post meta of a post that has just been published?

I am using the hook publish_post to run my code where I need the post meta of the just published post. But the post meta value I am looking for is somehow not available at this point of execution. On ...
2
votes
2answers
2k views

Echo all meta keys of a custom-post TYPE

Is there a way to dump a list of all meta keys being used by all posts belonging to a custom post type? I.e., a post-type named foods, each food (ham, spaghetti, chicken), can have a different meta ...
2
votes
1answer
1k views

order by numeric value for meta value

I have read countless posts on ordering data by numeric value ( as opposed to string - it i have a numeric meta value and it gets ordered like this 1 11 12 2 233 etc as opposed to the way i want it I ...
2
votes
2answers
212 views

Automatically adding meta data to posts or multiple query help

I run an events company whose website uses a custom post type system for posts (blog), events and tickets all stored as CPT's in the DB. On the guestlist (which counts 'ticket' custom posts if the ...
2
votes
1answer
134 views

Exporting Data from WordPress into a flat table

I need to be able to export the data within WordPress so that each object is contained in a single row, like a flat table. Imagine each post type as it's own database table, containing columns that ...
2
votes
1answer
498 views

How to update/delete array in post meta value?

I using post meta like.. $meta = get_post_meta(99,'_mymeta',true); $value = $meta['somekey']; echo $value; But how to update $meta['somekey'] to some another value ? How to use update_post_meta to ...
2
votes
3answers
45 views

Custom fields: In what order are they saved into the DB?

If I insert multiple custom fields to my article, they get sorted in "I don't know what" way. So when I insert some multiple fields in an article and call those via $cf = get_post_custom(); foreach ...
2
votes
3answers
421 views

Function to change meta value in database for each post

I have a meta key called 'prijs' in each post. The value of this meta key consist of numbers in the follow structure: 2,100.00 I want to remove the comma in the meta value to get this output: 2100.00 ...
2
votes
2answers
84 views

Identifying Importer Posts

Given a site with 100 posts, where an unspecified number of posts are manually written, and the rest are created using the WordPress importer, how would I programmatically identify the posts imported ...
2
votes
1answer
2k views

passing argument to get_template_part() or a better way to code

I have this include … event-list.php <?php /** * The loop that displays upcoming events */ ?> <ul class="event-items"> <?php $yesterday = time() - 24*60*60; $args = array( ...
2
votes
1answer
262 views

Create meta boxes that don't show in custom fields

I used the code below to create a metabox for posts. These meta boxes are also seen in the custom fields. I do not want these meta boxes to show in custom fields. Is there any way to not show meta ...
2
votes
3answers
619 views

Why am I getting an infinite loop with have_posts?

I have the following code, which causes an infinite loop for some reason. Can anybody explain what's going on please? Thanks! <?php $flagged_stores = new WP_Query( array ( 'post_type' => ...
2
votes
2answers
3k views

Query between two meta values?

How do I limit the query by two custom meta fields, a start date and an end date? This is what my data looks like: meta_key | meta_value | ------------------------| start_date | 20100131 | //Jan ...
2
votes
1answer
233 views

Save default value for empty or missing post meta

I am using WordPress and I am using a custom field that has the name ecpt_carprice for each post I am publishing, the field is saved in wp_postmeta the same as the attached image: Some of my cars ...
2
votes
1answer
238 views

unable to save post meta on single field with multiple selects

I set up two select boxes in one meta field by putting two arrays inside the 'options' array of my callback. The HTML is outputting fine, but the meta is not being saved to the database... Here is a ...
2
votes
3answers
564 views

metabox upload file

I have a custom meta filed with upload file functionality but the problem is I can't get the fileurl button value when hit "insert into Post" below are my jQuery code window.send_to_editor = ...
2
votes
3answers
1k views

Search everything (posts, pages, tags, cpt, meta)

I would like to know how to use the built in wordpress search to return results from all content on my site. Specifically, I want to search; posts pages tags custom post type (portfolio) custom ...
2
votes
2answers
1k views

Custom field values deleted when trashing custom post type

I've created a custom post type with 2 custom fields attached to it... When I create a post of this type and fill in the custom fields, the data is, in fact, saved to the db... However, if I trash one ...
2
votes
1answer
367 views

Metabox Data not being saved [closed]

My meta box won't save data. It's a select form field and when I select and update the post, there's nothing selected on refresh. So here it is on PasteBin. http://pastebin.com/tfrgasQC Can anyone ...
2
votes
1answer
2k views

meta_query: using BETWEEN with floats and/or casting to DECIMAL

Each post has a lat/lng value attached to it via postmeta. I'm trying to grab all posts within a bounding lat/lng value. Here's the get_posts query: $posts = get_posts(array( 'posts_per_page' ...
2
votes
2answers
437 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 ...
2
votes
2answers
700 views

Using date stored as custom field to filter posts displayed in admin

This seems like a fairly common problem, but I'm posting this as I've yet to find a solution to my problem here on WP Answers - any help is HUGELY appreciated! Ok - so I have a custom post type of ...
2
votes
1answer
282 views

Convert User ID's to User Names in a single.php file

I have a post_meta "thevoters" that store users ids like: 1,2,20 ...etc, How i can turn this id's to User Names to list them in a single page? This will echo the numbers as text, echo ...
2
votes
2answers
741 views

Conditionally Query Custom Post Types by Post Meta for Blog Home Page?

(Moderator's note: The question's original title was: "Custom query: Show custom post types plus custom post type with post meta on blog homepage") I'm in need of help with a custom query. I have ...
2
votes
1answer
863 views

Get all posts from custom post type and insert in select input as metabox

I would like to know if its possible to do something like this. I have Slider custom post type and Services custom post type. For slider posts I have created a metabox for URL value to display next ...
2
votes
2answers
1k views

Meta query with boolean true/false value

I'm trying to show all rental properties, first by all properties that have not been rented, and then by all properties that are currently rented. There is a custom post type 'rent' with custom post ...
2
votes
1answer
29 views

Set attached to state

In the media library every attachment post has an "Attached to" column. I've developed a plugin that adds author profile and a facebook like banner image. I now discovered that the attachment posts, ...
2
votes
1answer
275 views

Filter list by a unique meta value dilemma

I'm been racking my head at this for a while now, and I can't figure out how to fix the code. Here's the issue; I found a snippet of code online to filter my post results in edit.php based on ...
2
votes
2answers
264 views

What is an efficient way to query based on post_meta?

The problem I am having is when I allow users to filter posts it overpowers the database and things run extremely slow. I am unsure what the best way to query posts using meta values is. My site has a ...
2
votes
2answers
235 views

Millions of Rows — Possible Solutions?

I have a custom CMS, that we're looking to port over into Wordpress. (I can see you asking yourself, why not just stick with the custom CMS? Well, it's outdated, clunky, and getting to be too much of ...
2
votes
1answer
301 views

How to set author for post AND post attachments

I have multiple author accounts on one of my WordPress installs. Often I will create a post, and set the author to be a different account. However, when I upload images into that post, their ...
2
votes
2answers
682 views

Display info from custom fields in all images' HTML

Okay, I've been working on this all day and can't find the solution anywhere. I've created a custom field within the image upload screen (info first found here). The field stores the name of a ...
2
votes
1answer
914 views

wp_handle_upload error “Specified file failed upload test” but still creates attachment?

Having a bit of trouble with an image upload custom meta box. What happens is the uploaded image is created as an attachment but the wp_handle_upload seems to kick back the error "Specified file ...
2
votes
2answers
381 views

Wordpress Action Hooks and Post ID?

I'm creating a very basic Wordpress plugin whose purpose is to display a numerical value beside each post. My Logic for the plugin function (plugin.php) is this: <?php function foo($post_id){ ...
2
votes
1answer
162 views

Multi-line captions on attachments

How can I change the 'Caption' text input to text area, to allow for multi line captions on media uploads?
2
votes
1answer
173 views

Post IDs missing on delete_postmeta action hook

I'm using metadata in pages to store variables and do server side caching for dynamic generated PayPal buttons and other variables about the pages (page specific). I'm trying to hook the page meta ...
2
votes
1answer
496 views

List posts under meta_value heading

I need to list completed (meta_value) projects for each year (meta_value), like this: 2006 - Project 1 - Project 2 ... 2005 - Project 3 ... I found (here) a great piece of code to deal with I'm ...
2
votes
1answer
84 views

How to make orderby 'meta_value_num' OPTIONAL?

$args = array( 'cat' => 5, 'posts_per_page' => 8, 'meta_key' => 'custom_sort_order', 'order' => 'ASC', 'orderby' => 'meta_value_num' ...
2
votes
0answers
80 views

Content hooks vs User hooks

This is more of a theory question than a question with a direct answer. I've been working with different actions for firing functions when a post is updated or deleted and when users are updated or ...
2
votes
1answer
510 views

Admin Area Custom Type Search By Meta Fields Without Title & Content

I have a custom post type that uses several meta fields. In the admin area I would like to be able to search by those meta fields. I have implemented this currently in my functions.php with this code: ...
2
votes
0answers
313 views

Copying Custom Meta Values from existing post to a duplicate post

I'm trying to revise an existing WP plugin BU Versions to accept different custom meta field values from items I've set-up using the Advanced Custom Fields (ACF) plugin. BU Versions will copy over ...
2
votes
1answer
381 views

Save HTML formatted data to post meta using add_post_meta()

Array ( [post] => Array ( [jw_objective] => Exposure to e<b>nd to end development</b> of various applications; right from requirement analysis to system ...
2
votes
2answers
312 views

Grouping related postmeta data via SQL query

I am using someone else's WP plugin which stores lots of related data in wp_postmeta using an "artificial key". So effectively we hijack wp_postmeta to create a nested relational database. So one row ...
2
votes
2answers
188 views

Author Page Custom Query WHERE author OR [post meta value] OR [post meta value]

I am currently trying to perform a custom query on the authors page (author.php). I have two custom fields for posts that I want to query against (post_photographer and post_videographer). What I am ...
2
votes
1answer
233 views

Create a Metabox that behaves Like a Taxonomy Box

I need to show all my custom articles on an archive page but grouped/sorted by subject. So that the result is somewhat like Subject A: A Sample Post Another Sample Post Subject B: List item ...
2
votes
5answers
1k views

Remove Wordpress.org Meta link

In my footer, I have a set of links labeled Meta, it has... Register Log in Entries RSS Comments RSS Wordpress.org How can I remove just the wordpress.org and and comments rss link from the meta ...