3
votes
1answer
28 views

Query Custom Meta Value with Increment

I have a Query searching for a meta value I have added to my posts (meta-select). I have it feeding out in a loop with 4 results. Let's say I want this loop to start with the meta value "2" and work ...
0
votes
0answers
12 views

Incorporating a meta query into a mysql query in wordpress

I'm trying to find a way of inserting a meta condition into this bit of SQL below... $query = "SELECT COUNT( ID ) as num_events " . "FROM $wpdb->posts " . "WHERE ...
0
votes
1answer
33 views

Custom MySQL Query for Post and Post Meta

I have a custom table called "tags" that contains a charity_id that is a reference to a post ID ... I need to query the "tags" table to grab this charity_id and then pull in the post title and a few ...
0
votes
0answers
94 views

SQL query for converting post meta image url to featured image

WordPress guru, we have a question: We work on a website, which was not updated a while. Most of time it have wordpress 3.2 installed. We've updated it to the latest wordpress version, but ...
2
votes
2answers
195 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 ...
0
votes
1answer
1k views

Search custom post type by meta data

I have a custom post type 'Property' which my users need to be able to search by meta data. I have 3 search functions - 2 on the frontend 1 in the admin area - 2 of which are running as expected and ...
0
votes
1answer
62 views

How to query post ids liked by the Author

I'm using wti_like plugin and this is how i get the number(count) of post liked by the author // Get the author object $author = get_user_by( 'slug', get_query_var( 'author_name' ) ); // Get the ...
2
votes
1answer
215 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 ...
0
votes
0answers
132 views

query by meta value then date and not empty meta value

So i have a query like this function filter_where( $where = '' ) { // posts in the last 7 days $where .= " AND post_date > '" . date('Y-m-d', strtotime('-3 ...
1
vote
1answer
48 views

How can I sort homepage by a meta value?

I am trying to sort my home page posts by a custom meta value. I've been told I should use pre_get_posts but I seem to not be implementing it correctly. This is what I am doing: ...
0
votes
1answer
99 views

Adding an orderby filter, casting postmeta with multiple keys

I am using this filter to sort my query by a date field stored as text (legacy data) add_filter( 'posts_orderby', 'my_posts_orderby_date', 10, 2 ); function my_posts_orderby_date( $orderby, $query ) ...
0
votes
0answers
100 views

Retrieve post data via WPDB class

I'm trying to figure out doing a custom query using the $wpdb Object. I have custom type posts, event_posts, that have meta data, images, as well as event dates which are input in the post with the ...
0
votes
1answer
347 views

WP_Query meta compare must include ALL array values

I am allowing users to query posts using a form with checkboxes. I want the posts to be filtered by the checkboxes but instead of showing all posts that include the ANY of the meta values selected I ...
0
votes
1answer
241 views

Exclude posts by post meta value

I have constructed this query to sort posts on the home page by a set position number in a custom field. However, I need to be able to exclude posts with the position set to '0'. Below is the code ...
2
votes
2answers
297 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 ...
0
votes
1answer
138 views

Combining two meta_values within one row with query

I've added two new meta_keys to the wp_usermeta table: bid_user_lat and bid_user_lng And I need to be able to get both of these values within a single row, along with the user_id. ROW - (user_id) ...
1
vote
1answer
258 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
79 views

Limits, not all post are showen when querying for posts by view count

I'm having some difficulty getting a loop that gives me post by most viewed. I started by following this tutorial ...
1
vote
1answer
252 views

Pull post meta with post_query?

I'm building a custom index loop that just uses query_posts at the moment. The issue is that inside The Loop, I have to then query for the post meta data (with get_post_meta), which I believe has ...
0
votes
1answer
364 views

Excluding posts by meta, and also keeping posts without the meta

edit: Think I managed to figure it out, check the answer right under here, or click the following link: http://wordpress.stackexchange.com/a/51175/15809 I've been trying to find a way to exclude ...
0
votes
1answer
782 views

mySQL query. ORDER BY meta_key

I'm fighting this quite long already and start to think I'm missing something big. CPT posts could have or not metadata ( _vip_post [0|1], _thumbnail_id [null|numeric] ). If i query for ...
0
votes
1answer
386 views

Remove posts from query for events whose start date has passed

The query below works as expected, showing cpt event ordered by meta_value, what I haven't figured out yet is how to remove posts for past events or events which have started. The start date for ...
0
votes
1answer
480 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 ...
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 ...
0
votes
1answer
601 views

How to query two meta fields and display results between them

I am making a search form that searches for posts within two meta box values and display results between them. I have this set $prefix = 'ghes_'; // start with an underscore to hide fields from ...
0
votes
1answer
243 views

Query posts WITHOUT a custom meta field

I'm trying to build a custom query that will return all posts that DON'T have the associated post meta. I'm not quite sure how to do this...here is what I am working with, and for your reference ...
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 ...