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

learn more… | top users | synonyms

12
votes
4answers
22k views

WP insert post PHP function and Custom Fields

The wordpress function is used for submitting data programatically. Standard fields to submit to incude the content, excerpt, title, date and many more. What there is no documentation for is how to ...
17
votes
4answers
31k views

Advanced search form with filters for custom taxonomies and custom fields

I'd like to build an advanced search form for a specific custom post type, having filters for the custom post types custom fields, custom taxonomies, and for a separate custom post types properties ...
10
votes
3answers
6k views

Passing error/warning messages from a meta box to “admin_notices”

I have a simple meta box that updates the post custom fields (using update_post_meta()). How can I send a error or warning message to the next page after the user publishes/updates the post and ...
8
votes
2answers
7k views

How to hook update_post_meta and delete_post_meta?

I'm still struggling to get my head around this whole hooking into things, so I'm really stuck on trying to do the following task: If update_post_meta is fired then check to see if the meta_key is ...
0
votes
1answer
1k views

Custom query with category exclusion and post-meta “whitelist”

I have two widgets, one shows News while the other shows everything except News (We'll call the second one Blog). The blog portion is currently working correctly. The News posts are either ...
11
votes
5answers
3k views

Can the Next/Prev Post links be ordered by menu order or by a meta key?

I have a series of posts that are ordered by a meta_key value. They could also be arranged by menu order, if necessary. The next/prev post links (generated by next_post_link, previous_post_link, or ...
3
votes
2answers
459 views

How to use Post Custom Metadata in Post Titles and Post Permalinks

I am very new to WordPress. How can I use post custom metadata in place of Post Titles, and as the Post Permalink? For example, instead of domain.com/the-post-title, the permalink would be ...
1
vote
1answer
728 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 ...
7
votes
2answers
2k views

post formats - how to switch meta boxes when changing format?

Problem After realizing that post formats are pretty popular, but only a extremly rough drawn concept, i see that users will run into possible traps. Post format ... uses post meta fields & ...
13
votes
4answers
7k views

Post meta vs separate database tables

When developing plugins that requires data storage, what's the pros and cons of using one method or another ? The explanation given in the codex is not detailed: Before jumping in with a whole ...
9
votes
5answers
15k views

How can I show posts only if meta_value is not empty

Three people have already tried to solve this, and we're coming up nil. I want to show only posts that have a value in the meta_key 'featured_image'. So... if 'featured_image' is not empty, show the ...
3
votes
2answers
6k views

Properly add an upload media button in a meta box field

i have a custom post which has a meta tag that needs to be using a file upload (for video files). I am wondering, what is the correct way of adding an Upload button that points to the wordpress media ...
0
votes
1answer
2k views

Get Advanced Custom Fields values before saving [closed]

Basically, I need to alter the info the user inputs into an advanced custom fields textbox before it is written to the database but I don't know how to grab it. I can only get it after it has been ...
5
votes
5answers
8k views

Most efficient way to get posts with postmeta

I need to get a bunch of posts with their metadata. Of course you can't get metadata with a standard posts query, so you generally have to do a get_post_custom() for each post. I'm trying with one ...
6
votes
1answer
963 views

Save camera info as metadata on image upload?

I am trying to have WordPress automatically save the "credit" metadata that is stored within images I am uploading. I know this would be entered as a custom post meta field using update_post_meta(). ...
3
votes
1answer
174 views

Adding an assisting editor box to Post page

I run a multiple author platform and to improve the moderation, I want to add a couple of assisting editors. I want to add a custom box to the Post page where the assisting editor can confirm which ...
3
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 ...
4
votes
2answers
448 views

Order by optional meta key?

I'm building the sorting functionality for a custom post type, and I have a custom meta value for "Featured" posts. This value is set when you tick the checkbox, otherwise it is not set. Using the ...
4
votes
2answers
2k views

How to add category to: 'wp-admin/post-new.php'?

I want to have a link to create a new post that sets the category also. I have tried wp-admin/post-new.php?post_category=12 and wp-admin/post-new.php?cat=12, but neither worked. I also tried using ...
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 ...
1
vote
1answer
439 views

Save both current and new version of post meta

I want to save two versions of my custom meta box data called "sidebar". I want to compare a new and old version of this data later on, so that is why I want to save a copy of the current "sidebar" to ...
1
vote
1answer
631 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
3answers
312 views

Grossly inefficient wordpress loops!

I'm working on a site at the moment for an orchestra. The various members need to be listed, according to their instrument. The members have a custom post type of biography and I'm capturing the ...
0
votes
1answer
482 views

Custom Query: query by post custom meta data

So I have a custom post called event, but I need to query only those posts which have a custom metabox(is a checkbox) called `Show On The Homepage: and only if that checkbox is checked. <?php ...
0
votes
1answer
796 views

Time & Date on Post - Time Ago Custom Function

I'm using the following custom function to display the timestamp for a post as posted "X minutes ago" or "X days ago" for 14 days and then this changes to the actual date (e.g. 17th December 2010): ...
0
votes
1answer
675 views

How should I use posts_where to change meta_value from a string to integer?

How should I use posts_where to change meta_value from a string to integer?
3
votes
2answers
472 views

Post metadata deletes itself

I'm using a custom post type for a portfolio. I have a few option in there, bring saved by update_post_meta(), it seems to work fine, but then out of the blue (within the hour), the data deletes its ...
1
vote
1answer
1k views

I can't set meta_key in my custom post type query

I've created a custom post, events, and saved the meta data event_year to each event. I'm trying to get a year's event archive. When I go the the following URL, the meta_key and meta_value are not ...
0
votes
1answer
108 views

Compare 3 custom fields and sort by oldest

I am building a movie archive. For each movie I am filling out the release dates for 3 countries, they're stored as custom fields (added via Pods) Now, when listing the movies I would like to build ...
0
votes
1answer
8k views

How to get meta box values - WP tuts tutorial

I did these tree tutorials to create custom metaboxes. wp.tutsplus.com/tutorials/reusable-custom-meta-boxes-part-1-intro-and-basic-fields/ ...
6
votes
3answers
9k views

Attaching taxonomy data to post with wp_insert_post

I am implementing (trying) a front end posting system which shows taxonomy data in several dropdown select fields, each of the dropdowns is named by using the "name" $arg in wp_dropdown_categories. ...
3
votes
1answer
645 views

How to enable users to down-vote in this simple voting counter (that uses the post meta)?

This simple tutorial teaches you how to make a voting counter using the post's meta data. I would like to know how to add down-votes to this small script (e.g. -1, -2). In the following way: If the ...
3
votes
2answers
4k views

Can I exclude a post by meta key using pre_get_posts function?

I see many people prefer to use pre_get_posts hook instead of query_posts. The code below works and shows all posts which have meta key "featured" function featured_posts( $query ) { if ( ...
3
votes
1answer
5k views

How to save an array with one metakey in postmeta?

I have an array saved in postmata, each array key become a metakey. I want to change the code to save the whole array with one metakey. How to do that? Thanks! $poddata = Array( 'pod_id' => ...
9
votes
3answers
9k views

Order by meta value or date?

Got a custom field called startDate but its only on a few events. I was wondering if it isn't set for a post I could use post_date to generate the posts list? // if meta_key _postmeta.startDate isn't ...
3
votes
2answers
2k views

How do I paginate search results for custom post types?

I have a Custom Post Type called "cars" that stores several custom fields along with the standard Title/Description fields. I need users to be able to search through the CPT based on the custom fields ...
2
votes
1answer
324 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
1answer
500 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 ...
0
votes
2answers
3k views

Wordpress wp_head() crap

I know, wp_head() is important, but it inject so much crap into the header, i like to get it out... and just add manually the 2-3 line of code i need.. BUT, and there is always a but, i need the ...
3
votes
1answer
1k views

Auto sort the wp-admin post list by a meta key

I am using this following code in my functions file to hide and add some custom columns to my post-edit screen in wp-admin. I am now trying to get the post list to sort by a post meta field (last ...
3
votes
1answer
2k views

Filtering posts by post meta data

I want to filter posts in such a way that only posts, for which get_post_meta($post->ID, "project_cat", true) (it returns a post ID) is equal to my specified value, are shown. Any way to do this? I ...
3
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
0answers
81 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
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
1answer
268 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
655 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
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 ...
1
vote
2answers
2k views

display specific custom fields

I have few custom field assigned for each post, like: "Club" with value "club1" "Date" with value "date1" and so on... Now, I want to display from all the custom fields just those 2 " club" and ...
1
vote
2answers
969 views

WP_Query not working as expected for attachments and custom meta_query

If I use get_posts() like so I get a number of results with the value 1 for the my_key meta_key: $posts = get_posts( array( 'post_type' => 'attachment', 'meta_key' => ...
1
vote
3answers
384 views

Transients vs CRON +Custom Fields: Caching Data Per Post

Wanted some opinions on a solution I'm trying to come up with: I have a fan/enthusiast plugin I'm working on for fans of TV shows. One of the custom post types attached to the plugin is a release ...