Tagged Questions
0
votes
1answer
22 views
How do I query for posts by custom meta and those that have been stickied?
I realize how clumsy and inefficient this query is but SQL is not my strong point. I use the following query to pull the latest 8 events from a custom post type called Event Posts. However, I also ...
1
vote
1answer
20 views
wpdb query problem to access previous 3 days posts
I am trying to get all published posts titles by author id 2 most recent by post date for the last days. Here is my query:
"SELECT post_title FROM $wpdb->posts WHERE post_status = 'publish' AND ...
0
votes
0answers
47 views
Special Query: Title, Terms, Content - %LIKE%
I'm working on a them theme that is search-heavy, and my users are putting huge priority on an improved search function.
I think I will have to use a special direct query to search these things:
...
0
votes
0answers
16 views
Cannot insert % sign in SQL [duplicate]
I cannot insert a % sign in the SQL database. I'm using the following function:
$wpdb->query($wpdb->prepare("insert ".$wpdb->prefix."dq_category_master_catrules set ...
0
votes
1answer
34 views
learn to run wpdb class
I want to learn how to run commands through WP rather than SQL commands
I have a SQL command:
SELECT
post_id,
(select meta_value from wp_postmeta where meta_key = a 'geo_latitude' AND x.post_id = ...
1
vote
1answer
44 views
Wordpress Custom post query sorting does not work
I created a custom WP query to collect products that have 3 different taxonomy values in them and sorted them by price using the following:
$my_products = new WP_Query(
array(
...
0
votes
2answers
135 views
SQL query to get posts from multiple categories but not in a category
I need to get the last posts' ID and the post_tile within categories 1 and 2, and exclude those within category 3. It must be SQL, because if I use WP_Query it retrieves too much info and I only need ...
0
votes
1answer
134 views
Export all posts to import as product items
Up until now, my client has been using WordPress posts as his way to display his products. I now need to export all these posts into a CSV format so that I can format the CSV file and import it back ...
1
vote
1answer
77 views
Get the timout value of a saved transient?
Does anyone know if there is a Wordpress function to get the timeout value of a saved transient? I am using a transient with a 5 minute timeout to cache data from a web API call locally. Between ...
2
votes
1answer
164 views
Multipart/formatted MySQL query problem
I'm creating a plugin and I want to automate the creation of a MySQL Trigger on a table. The problem seems to be that $wpdb->query doesn't appear to accept either multipart statements and/or formatted ...
0
votes
2answers
385 views
How to rename a custom field?
I have 3000 posts with that custom field name 'refer' and i need to change it to 'ref' for theme needs, instead of doing it manually i need a query or technique to change them all.
Question 1
I am ...
0
votes
2answers
311 views
Display latest post from Wordpress Featured Category that is also in X,Y,or Z categories
I want to display the latest post from a "featured" category (id=1) that may also be in either X category, Y category, or Z category (id=2,3,4 respectively). Note, there are other posts in categories ...
2
votes
1answer
552 views
orphaned taxonomy terms remove by sql query
I have 3 custom post types each of these CPT's have posts that are set to auto delete via a given time scale by cron jobs, thing is when they are deleted it leaves behind orphaned taxonomy terms in ...
3
votes
1answer
159 views
How to make an activities stream mixing posts and comments?
What I'm currently trying to make is an activities stream wich list :
The posts,
the comments,
both mixed between them and ordered by date.
My idea is to make two queries, but i don't know how to ...
5
votes
6answers
16k views
What SQL Query to do a simple find and replace
Whenever I create a new website I first create a staging site on a subdomain like "stage.domain-name.com".
After everything works correctly I export the database, open it in notepad++ and do a ...
0
votes
1answer
2k views
Overriding default calendar to show posts from a category
I'm trying to modify the default WP calendar (get_calendar()) so that it shows posts from a specific category and then use that as a shortcode.
Here's what I've done:
Copied across the ...
2
votes
2answers
1k views
Alter query on edit.php
What's the best way to alter the query being run on the Posts Edit screen (edit.php)?
The current method I'm using is by passing an argument to the global $wp_query like so:
$wp_query->query( ...
15
votes
5answers
18k views
How to display sql query that ran in query?
I have come across a function before that displayed the exact SQL code that was used
in a loop for example, but can't remember.
Can anybody tell me that function?
Cheers
