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

learn more… | top users | synonyms

2
votes
2answers
391 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
293 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
353 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
395 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
5answers
2k 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 ...
2
votes
2answers
735 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
1k 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
441 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
171 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
178 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
511 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
68 views

Efficient way to save a lot of meta data

im currently developing a plugin that will read an external xml, and convert the data to a custom post type. Each post needs around 50-60 meta_fields. Right now im looping through each piece of needed ...
2
votes
1answer
218 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
1answer
708 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
508 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
2answers
593 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
1answer
253 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
2answers
326 views

Single reusable value for post meta: Custom Taxonomy or Post Meta?

Suppose I have a post meta like "Region" it will contain values like "Region 1", "Region 2" etc. But it should only contain ONE value. Also I would like it to have an archive page. If I use custom ...
2
votes
2answers
800 views

Display all custom post type posts and order them by an optional meta_key

I have a custom post type (CPT) called property. I have registered a featured property metaboxfor it as explained in this question "How do I create a featured post within a custom post type?". So a ...
2
votes
2answers
306 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 ...
1
vote
3answers
744 views

Custom post type category not displaying in custom post type

I've created a new custom post type (lets call it "Reviews") on the backend of my Wordpress. It works fine for the most part but the Categories I create within that Custom Post Type are not displaying ...
1
vote
2answers
1k 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
4answers
2k views

WordPress is stripping escape backslashes from JSON strings in post_meta

I thought I was making my life easy and being future-conscious by saving some content as bits of JSON in custom post_meta fields. Unfortunately, WordPress doesn't agree and is making my life ...
1
vote
2answers
1k views

Wordpress Menu Disappears when $query->query_vars['meta_key'] is set

I've set some meta variables on my WP posts. I want to be able to sort by these variables, and everything is working great except when I sort by either "views" or "likes". When I sort by either of ...
1
vote
3answers
458 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 ...
1
vote
1answer
2k views

Redirect blog page to latest post?

How can I make it so when the blog link in the nav bar is clicked it redirects to the most recent post? I know how to display just the latest post on the blog page, but I want it to actually redirect ...
1
vote
2answers
3k views

Query 2 meta key values and a category

I have a wp query that works great - it returns a list of featured posts. WP_Query("category_name=office&meta_key=featured_post&meta_value=Yes&posts_per_page=3"); However I want to add ...
1
vote
5answers
3k 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 ...
1
vote
2answers
1k views

Views count with time limit per IP

I've been looking for function about post views count. I found this simple functions using update and get post meta. function setPostViews($postID) { $count_key = 'views'; $count = ...
1
vote
6answers
805 views

trying to do if post meta !=0

im trying to do a simple if function on my code but for some reason it just isnt working correctly, ive gone over it several times to see if there is anything im missing but no luck, im trying to say ...
1
vote
2answers
7k views

How to sort by meta value?

How can I sort by meta value? In meta value I have "price" (float). I make this query, but always get Sorry, no posts matched your criteria. $posts = query_posts( $query_string . ...
1
vote
3answers
319 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 ...
1
vote
5answers
195 views

Best approach to create Hot and Trending sections

I am going to implement a Hot and Trending section on a website. I have seen such sections on many popular websites but can't really figure out how exactly this works. Although I assumed Hot section ...
1
vote
3answers
83 views

Orderby meta_value only returns posts that have existing meta_key

I have the following wp_query: $args = array( 'post_type' => 'news', 'orderby' => 'meta_key', 'order' => 'ASC', 'meta_key'=>'custom_author_name', ...
1
vote
2answers
850 views

WP_Query displaying ALL posts

I cannot figure out why my WP_Query always displays all my published posts regardless of what I put in the arguments. <?php $args = array('numberposts' => 1, ...
1
vote
1answer
127 views

Is it possible to store visitors IPs in wp_postmeta table?

Or in any of the other 11 Wordpress tables. I also need to store: submission date, name, contact number in the same table. What approach would be best? A custom table or using a standard table?
1
vote
2answers
653 views

order by multiple meta_keys?

Hi i'd like to order by multiple meta_keys want to make it order using these keys adminscore + user_like + _count-views_all + comment_count combine these keys how should i array order it?? i try ...
1
vote
1answer
377 views

Use a function to update post meta based on other post meta

No idea how to title this so feel free to edit. I set out to create a "hotness" for my posts and to do this I used the $ratings_score which is stored as post_meta as a number +/- and the days ago of ...
1
vote
2answers
1k views

get_template_part() - post-meta not working?

Maybe I simply do not understand what get_template_part() is doing … I have a file called event-list.php that should work as template for other pages and files so all my events (a custom post type) ...
1
vote
3answers
1k views

MySQL query to set wp_postmeta using term_taxonomy_id value

I have a need to set the wp_postmeta value (in table: wp_postmeta) on every post that has a specific term_taxonomy_id (in table: wp_term_relationships): Specifically: run a query against every ...
1
vote
2answers
77 views

need advice on how to do a lists using custom post types - taxonomy vs postmeta

i am building a lists plugin .... i want to have a custom post type "lists" and then obviously also there would be a number of list items for each list .... i have read a fair bit of stuff about ...
1
vote
2answers
344 views

conditional function to change post-meta background image

I have this CSS setup for my blog posts meta information. But there are certain categories where I would like to use another image in the same spot and not display the meta information. I'm not quite ...
1
vote
2answers
1k views

post meta data clearing on autosave

For starters I am using this GREAT answer to achieve custom post types as well as a custom way to insert those post types into other pages, you can view that answer here: Custom field/meta populated ...
1
vote
2answers
5k views

How to store multiple input values with same meta_key

is there a way to store the input value from multiple custom meta box fields with the same meta_key? I use the following code to store ONE value for the meta_key 'startdate': function startdate() { ...
1
vote
1answer
55 views

Sorting and limitation with pre_get_posts

This is my third question regarding WP queries and pre_get_posts (sorry about that) but I cant give up one step before the full success :) So the story - my query is limiting front page posts to ...
1
vote
1answer
69 views

Meta Box Only in CPT Edit Page, Not in Add New

I have a CTP named leads and have 2 metaboxes added to the CPT new/edit screen. I need to have one of them only in edit screen, not in add new. Played with the codes provided in couple of answers, ...
1
vote
2answers
963 views

How to keep a check box in custom meta box for custom post type checked by default for add new post?

In my custom plugin, I have a custom post type and have a custom meta box for it. I have few fields in it, one of it is a check box. I want this check box to be checked by default when I go for a add ...
1
vote
1answer
4k views

How to add multiple featured image in meta box in post editor?

I would like to add multiple featured image in meta box in post editor area apart from default available featured image. I have added the meta box but i have no idea on adding the featured image ...
1
vote
2answers
3k 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
2k views

Adding Multiple Values to a Post Meta Key

I have a question about adding multiple post meta values to a post meta key. Here is a link to the WordPress add_post_meta(); function in question. The $unique parameter is a little on the fuzzy ...