Post meta is a data set containing additional core as well as custom post information.
2
votes
2answers
680 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
15 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
129 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
654 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
282 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
125 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
143 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
410 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
151 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
125 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
0answers
140 views
Change post format using custom field
I'm creating a theme using the CF Post Formats plugin. But I've run into some trouble I don't know how to solve. Here's what I want to be able to do:
Create a new standard-format post
Enter a url ...
2
votes
2answers
83 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
2answers
84 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
174 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
248 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
675 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 ...
1
vote
4answers
3k 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 ...
1
vote
2answers
213 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
437 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
229 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
2answers
2k 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
1answer
744 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
6answers
518 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
3answers
273 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
3answers
921 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 ( ! ...
1
vote
2answers
483 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
1answer
32 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
1answer
490 views
Query all posts where a meta key does not exist
I am trying to get a query to retrieve all the posts where a specific meta_key does not exist and then create it.
I am having problems finding those posts as the query I am testing does not seem to ...
1
vote
1answer
250 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
3answers
730 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
66 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
267 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
974 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
1answer
137 views
One post carries 30 postmeta values, is this too much?
I have some data saved as post meta, occasionally some plugins may save an extra piece. Now I installed bbpress, it saves at least 10 pieces of post meta. Adding them together, there are nearly 35 ...
1
vote
2answers
630 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 ...
1
vote
2answers
482 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
1answer
229 views
How to update Post Meta values through the comment system
I'm working on allowing users to rate posts - through the comment meta. Storing and displaying individual ratings is working, however, I would like to be able to store the average rating in the post ...
1
vote
1answer
252 views
How to Display Image Meta underneath EVERY image in EVERY post
First off, I want to say thank you for taking the time to even read this, I really do appreciate the help this site and it's community has given me thus far.
i have looked forever to be able to ...
1
vote
1answer
468 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 ...
1
vote
2answers
994 views
Export entries and multiple custom field meta to .csv?
First time poster. I'm trying to export a bunch of custom posts out to a csv file so I can easily import them into a new database. I've ran the native export to xml, but it's not the correct format I ...
1
vote
1answer
543 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 ...
1
vote
1answer
94 views
how to interconnect custom post types?
I'd like to make a site about choirs, composers, conductors and singers. And so far I decided that I need to make a custom post type for "piece" -- any piece can be associated with choir[s], composer, ...
1
vote
1answer
149 views
How to use post_id with a Class?
I made a plugin for some calculation.
Class Math {
var $id; // I want to map this id to post_id
var $a;
var $b;
var $c;
function calculate{
$this->a = $value_from_post_meta_input_box;
...
1
vote
2answers
2k views
Wordpress Orderby Numeric Value Not Working
I am trying to get all products from the wpsc-product post type and then display them by a custom meta field called release_date_year. However, it doesn't appear to be ordering my posts by this custom ...
1
vote
2answers
2k 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
2answers
1k views
Filtering multiple meta_values
I'm trying to create a filter using two meta_values.
Example.
If the current page has meta values red and blue, only display queried pages that have both red and blue and none that have just red or ...
1
vote
1answer
282 views
Set Expiration Date of a Post from the Frontend with wp_insert_post
i try to build a form that users posts from frontend,
everything works fine but i need to know if it's possible,
if i play with the 'post_date' => date('Y-m-d H:i:s')?
if i add a hidden field that ...
1
vote
1answer
6k views
using multiple meta_key and meta_value in query_posts
how can i use multiple meta_key and meta_value in query_posts?
For example, I want to find multiple content with two different meta_key and meta_value. How do I do this?
i using this code but not ...
1
vote
1answer
784 views
Add text to post list/edit screens?
I'd like to add some descriptive text underneath the page title on both the list and edit post screens for the default post and also custom post types - e.g. "Below is a list of your recent blog ...
1
vote
1answer
27 views
WP_query posts closest to todays date
I have written an wp query which I would like to order in a bit of a complicated way. Some posts have a meta value 'the_date' which is an end date for the post. I would like to order posts in date and ...