A generic term referring to the process of retrieving information from a database.

learn more… | top users | synonyms

0
votes
0answers
11 views

Adding a term to a listing inside of shortcode that otherwise contains permalinks to custom post items with custom field values

I have this shortcode to output all items of custom post type "song", on a page listing all the songs a musician released throughout his career. // Custom shortcode, to query tracklistings on the ...
0
votes
1answer
22 views

Wrap a div around a query and how to bring a post in a category to the top?

First off, this is my code: <?php $args = array( 'tax_query' => array( array( 'taxonomy' => 'post-status', 'field' => 'slug', 'terms' =&...
1
vote
1answer
19 views

Insert static element only once in query archive

I'm looking to insert a foreign div-element only once in a archive query on my page. So that for example: Post1 Post2 [Static Div] Post4 Post5 ...etc My query is: <?php $archive_args = array(...
2
votes
2answers
2k views

Get category slug and display it on a query_post

I just read "How to create option page for wordpress theme" in wp.tutsplus.com - I have a problem with getting categories . there is two parts to my question - Part A - Get category slug and ...
0
votes
2answers
517 views

get_posts showing only 5 posts. (nopaging and posts_per_page -1 not working)

I have this piece of code which works but it's showing only 5 posts (with custom taxonomy) where should be 7. If I hit the tag url, it shows the 7 registries, so the problem it's in this code and its ...
1
vote
1answer
100 views

Query posts by content lenght

I am using the code below to pull a random post of my site every 6 hour. if ( false === ( $social_trans_post_id = get_transient( '$social_trans_post_id' ) ) ) { $args = array('...
0
votes
3answers
59 views

Is temporarily overwriting $wp_query a bad idea?

I am in the process of rewriting a lot of my code and restructuring a lot of my theme files to use template parts (i.e. using get_template_part()). I've come upon a situation where I want to use the ...
1
vote
1answer
710 views

How to reduce the number of queries?

I have meta key "Due" for posts....if a post has expired (past the current date or not equal to it) then it will not be displayed in the count. This is my code, which works perfectly. My only problem ...
0
votes
1answer
815 views

Load more posts with multiple queries

I've been developing a theme which uses the load more ajax plugin, everything is setup and working great with the main query. But, once I setup a new query for popular posts, the load more posts ...
1
vote
2answers
547 views

How to retrieve attachments from child pages of a specific Page?

How would I retrieve attachments from all subpages of a specific Page ID? Example: SPECIFIC PAGE Child (with attachments) Child (with attachments) Child (with attachments) I'm currently ...
0
votes
2answers
1k views

working with term_relationships table

I have this little code to insert posts via custom form: $post = array( 'post_author' => 1, 'post_title' => 'my title, 'post_content' => 'my content', 'post_category' =&...
0
votes
2answers
843 views

SQL to update custom post taxonomies

I have a custom post "review". It uses the same categories and tags from default posts, so they share "category" and "tag" taxonomies. But later I changed the "review" register to have their own ...
0
votes
1answer
655 views

How Do I Merge Categories With phpMyAdmin

I tried the following phpMyAdmin query to merge my category 112747 into my category 112748: UPDATE wp_term_relationships SET term_taxonomy_id = 112747 WHERE term_taxonomy_id = 112748; It did not ...
1
vote
0answers
12 views

get the taxonomies terms associated with users

I’m building a search form with meta_query to get users based on meta_key and meta_value. Some meta_key are taxonomies. It works very well but in my select, i have all terms and some terms are not ...
0
votes
0answers
16 views

can I separate two taxonomy (category) loops on one page

I have created a staff and teachers page with custom posts and categories. I currently have them display in an archive-teachers-and-staff.php template with no filter. I am using the date to get the ...
1
vote
1answer
10 views

cache specific data?

I want to display some information from database in each post, for example date of registration of user and user role etc. It is quite static data that doesn't change. Now if I make a query to the ...
0
votes
1answer
16 views

How to run a mysql query when admin updates user role?

I need to run a query when the admin changes the user role in the admin panel. Right now, this is my code: add_action( 'set_user_role', 'my_function' ); function my_function ($user_id){ $user = ...
0
votes
3answers
465 views

search through post-type attachments titles

I have a page where I show all the attachments of a page in a table which has id=10. I have hundreds of attachments and I would like to implement an AJAX search form that uses the title of attachment ...
0
votes
2answers
1k views

Make a WP Query search match exactly the search term

I'm using WP Query and the results coming back when using the search term aren't working as I wish. For example searching for 'art' returns also results for words containing 'art' such as 'part'. How ...
0
votes
1answer
50 views

Bring a post to the top of the query if it's in a certain category?

I'm looking for a way to bring a post if it's in a certain category to the front (or top) of the list. The category is called 'first'. I don't think orderby supports category so what other options do ...
0
votes
1answer
537 views

Delete query won't run

This is the set up: <form method="post" action=""> <input type="hidden" name="delete_app_id" id="delete_app_id" value='<?php echo $adoptee->app_id; ?>' /> <...
0
votes
1answer
533 views

WP_User_Query with more than two custom meta values

I am trying to create a custom user query based on users' metadata. I have the following query created. $users = new WP_User_Query( array( 'search' => '*' . $search_name . '*', '...
0
votes
1answer
15 views

YearMonth datequery

I'm trying to make use of the Date Parameter 'm' which is for the YearMonth. I can't figure out what the query name is or how to use it to search for posts with it. Thanks
-2
votes
0answers
19 views

Hoping someone could explain some queries for me

The following queries are considerably slow on my site and I'm hoping someone could explain them to the best of their ability (what they're doing/requesting). SELECT SQL_CALC_FOUND_ROWS wp_posts.ID ...
0
votes
1answer
28 views

Add Hook for clearing transient when post is added

I have fragment caching implemented in a page. I've got the codes from https://css-tricks.com/wordpress-fragment-caching-revisited/. Which goes like this: function fragment_cache($key, $ttl, $...
3
votes
1answer
38 views

Difference between fragment caching and wp_cache

I've been really confused about these two caching modes. What's the main difference between fragment caching and wp_cache? Can both of them be used hand in hand? EDIT I've read about the fragment ...
-2
votes
1answer
48 views

Get Posts ordered by a date custom meta field

I have created a meta field for a custom post type. This is a date field that will always be YYYY-MM-DD. There could be 100s of posts so i cant query them all and sort afterwards. I need to be able to ...
0
votes
1answer
54 views

Custom query filter not working on woocommerce category page

I am trying to make custom filter for my woocommerce website. Everything is working fine in the shop page, but when I go to the archive page the filters are not working. I am recording each filter ...
0
votes
2answers
505 views

Custom search SQL Query to add custom field in result

I have to write my own MySQL query since I haven't found a good way to do it within wordpress functionality. I want the search query to search trough post_title / post_content & meta_key ...
0
votes
1answer
511 views

Display most viewed post from last 30 days is not working correctly

I've try several different loop to display the most viewed post from the last 30 days . . However its just showing the post from 30 dasy ago . . not from the last 30 days . . not the most viewed . . ...
-2
votes
2answers
55 views

How to show posts of a specific category

I am new with word press and I want to show the post of a specific category on my page. The name of the category which i want to show is home slider. Below is the code which I have used to display all ...
0
votes
2answers
23 views

Display posts by combining multiple meta key

Basically a post is an event therefor will be displayed once or twice, depending on meta key. Every post has at least two meta keys $start_time_1 and $end_time_1. Let's say i have two posts, title: "...
1
vote
1answer
634 views

Create Pop-Up Box with Custom Field Content Inside the Loop

I tried this using ThickBox first, then tried using some code I had that worked on another website... Total failure. The Goal: I have a custom post type (product) with a ton of custom fields. I also ...
1
vote
0answers
435 views

SQL query equivalent to WP User Query

I have the following WP user query code: //Get all users sorted by whatever $sorted_users = new WP_User_Query(array( 'orderby' => 'meta_value', 'meta_key' => 'satisfaction_rating', '...
1
vote
1answer
23 views

Search query -> Show all pages except certain template

These are my arguments for the search query: $args = array( 's' =>$s, 'post_type' => array( 'post', 'p24_cases', 'page') ); Using these arguments, the search results will show all pages ...
3
votes
0answers
43 views

How to find objects by terms

I am struggling with a search filtering. Firstly, my script is searching for users using natural search SQL. The query returns ids of users. Now I would like to filter them by terms which are assigned ...
-1
votes
0answers
24 views

What is the one-query (or the fastest) way to get posts and their terms (more taxonomies)?

Now this might seem like a similar question One query to get posts and their taxonomy terms but it is just similar and does not have proper answer. Goal: I need to get limited number of posts and ...
0
votes
3answers
2k views

How to delete all posts, categories and tags from Wordpress database

I have WP website with over 40,000 posts. Now I'll like to delete all posts, categories and tags. So All content and related meta. All I want to keep is static files. Is there a easy way to do this ...
7
votes
5answers
6k views

the_date() not working

I am using wordpress 3.2 and I did a query post like this: <?php query_posts("posts_per_page=1post=type&page=post_parent=10");?> Then I try to echo out the date of this post I queried ...
0
votes
1answer
1k views

WP Query Sort by meta value (date)

I have the following code where I want to sort by meta key "event_date" and only display posts after todays date and 3 weeks ahead. Somehow nothing happens, even when I'm stripping down the WP Query ...
0
votes
1answer
3k views

Retrieve and display data from custom db table in admin area?

So, i'm having a bit of an issue with a plugin i'm developing, I wonder if anyone can shed any light on the situation, as many, MANY searches have come back with zero help. :-/ Basically, my plugin ...
0
votes
2answers
42 views

Running Filter or Shortcode Before Query Prevents Excerpt from Showing

I've been wrestling with some code cobbled together for a function I found, first published circa 2009 and my inexperience with PHP has me at a loss. The function is designed to count episodes in a ...
0
votes
1answer
31 views

Is it possible to retrieve posts depending on meta_key LIKE condition? [duplicate]

I'm currently facing a little problem. I'm using ACF plugin which generate complex meta_key names when creating hierarchical fields. I found in my database meta_key named modules_1_content_0_module. ...
0
votes
1answer
29 views

How to make MySQL search queries with quotes

Hi everybody I run a wordpress based website and I'd like to store the search queries called by users to use them as analytics data to know what's most searched etc... So I have a custom table where ...
0
votes
1answer
754 views

Delete data from custom table in wordpress

i am trying to delete record from my custom table global $wpdb; $retrieve_data = $wpdb->get_results( "SELECT * FROM wp_paypal" ); echo '<table border=1 class="table table-striped"> <tr&...
4
votes
1answer
103 views

author.php with ACF and CPTs

As I write this, I'll do my best to avoid an XY Problem. What I'm trying to do: I'm trying to build an author.php template that: displays data from Advanced Custom Fields on the user's Profile ...
1
vote
3answers
598 views

Get ID of child from child slug, while knowing parent ID

I have a hierarchy that I need to get data from. It's the child (by slug name) that I need to get while already having knowledge of the parents. Highest Known Parent Page (slug : 'parent') |_ Child 1 ...
0
votes
0answers
15 views

Alter main archive, to show posts with meta as last

I'm having troubles with getting posts with meta_value "sold" as last in the main query of my custom Post type. The best/easiest way i can think of at the moment is to filter the "sold" posts out of ...
0
votes
1answer
49 views

Query Strings and Woocommerce

I've got a wordpress website and am using WooCommerce to sell registrations for applications that I develop. To streamline the registration process, I would like users to be able to click a ...
0
votes
1answer
33 views

How to use apply_filters?

So I am using a plugin which loads next posts as the user scrolls down in the single.php file. Inside the main php file of the plugin, there is something along the lines of // By default, don't ...