0
votes
1answer
273 views

Order posts alphabetically: how to set order=asc in mysql query?

I have this function: global $wpdb; // adjust the query to fit your needs $posts = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $wpdb->posts WHERE post_type = 'post' ...
0
votes
0answers
47 views

how to prevent words inside image tags from being update in a sql query via php

I need to update certain words inside wp_posts table (1032 posts in a specific time range) but I would like to exclude some words when they are inside tags like so: <img ...
1
vote
1answer
216 views

Custom MySQL Query with logic

I have wp e-commerce plugin installed and custom building custom global search My query looks like this SELECT * FROM aka_v_posts LEFT JOIN aka_v_postmeta ON aka_v_posts.ID=aka_v_postmeta.post_id ...
1
vote
1answer
285 views

How to optimize 'select found_rows()' query? Several 'high load average' alerts daily

I have 5,000 regular posts, 6,000 posts in one post type and 2,000 posts in another post type. Needless to say, that has made the wp_posts table quite large. Not to mention, I have custom taxonomies ...
0
votes
1answer
31 views

Assign a tag to custom post type using a query

I have a custom post type courses with a custom field level. I want to run a query (mysql or WP query) that runs through every course (post) and if the level is greater than 3, append a tag called ...
4
votes
2answers
567 views

mysql custom wp query

this code is designed to select posts with selected meta value in wordpress query <?php $values = $wpdb->get_results("SELECT DISTINCT meta_value FROM $wpdb->postmeta WHERE meta_key = ...
0
votes
1answer
453 views

query for filtering published posts?

i need to filter count based on a date and post_status = 'publish', how to write a query to filter, as far as now i have filtered based on date, what is the query need to filter based published post. ...
4
votes
2answers
2k views

Get posts by menu ID

I'm a little stuck here. I have a menu in Wordpress with some posts in it. What I would like is to retrieve all the posts as objects. I think I'm pretty close, but the SQL query doesn't seem to work ...
1
vote
3answers
434 views

Insert all post IDs in new database table

I have a plugin which creates a new database table. Upon activating the plugin is there a way to insert all my posts ids into that table? Right now I'm using an action hook to immediately insert the ...
1
vote
2answers
244 views

greatest() function returns undefined property

I'm using the mysql GREATEST() function to compare two table fields and display in a loop either one with the highest integer value. The 2 fields consist of vote scores for posts: UP or DOWN. ...
0
votes
2answers
963 views

Custom query_posts() parameter

I'm adding voting features to a theme. Visitors can vote posts Up or Down. I created a table for storing number of votes for each post and that works fine. Now I'm trying to sort posts by their votes. ...
0
votes
2answers
779 views

query_posts meta_key with current date

How to query Post with current date month with custom field: Here is my code <?php global $wp_query; $event_month = get_post_meta($wp_query->post->ID, 'eventdate', true); ...
1
vote
3answers
684 views

WordPress Custom Query

I have posts that use a custom field for start date and end date. query_posts returns an array of posts that exist in the category I'm filtering. How do I query posts using this custom field that has ...