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

learn more… | top users | synonyms

1
vote
1answer
19 views

What's the equivalent of Hide From Menus on MODX on WordPress?

In MODX, there's a checkbox on posts that will hide it from the main navigation and the post query. This is a very good way of making the post private for reviewing or simply having the post ...
-2
votes
2answers
112 views

How to display search query as formatted text?

I am trying to display a site vistors search query on the search page. The form has custom fields so is not showing if it's "Search" and it doesnt show none of my custom fields. My search form - &...
0
votes
1answer
103 views

How to get category link without a database query

I use Wordpress 4.3.1 with PremiumPress Business Directory Theme. The theme's homepage renders a list of categories using code that's basically: $args = array( 'taxonomy' => THEME_TAXONOMY,...
0
votes
1answer
58 views

Loop through incrementing custom fields

I created 4 custom fields for a specific page. Field type: Post Object (I grab thumbnails and titles from the posts) Field names: featured_content_1 featured_content_2 featured_content_3 ...
0
votes
1answer
119 views

Looping Through Custom Tax Terms and Displaying All Posts For Each

I'm using the following code to attempt to loop through each of the terms within my custom taxonomy category-film and then output the term name as a heading together with displaying all the custom ...
1
vote
1answer
93 views

Error when using setup_postdata()

I am trying to get the most recent and show it using the native function (e.g. get_the_title()), do NOT want to use $post['post_title'] but when I do this I'm an error. global $post; $featured_post =...
0
votes
1answer
29 views

empty query breaks other queries

Hi I have a cpt query which displays 1 latest event based on date. It works fine - problem is when date is < today (theres no future events to display) this query is empty and also breaks other ...
0
votes
0answers
65 views

SQL Query to export Buddypress Profile data

I need to use sql query to export for http://wpdatatables.com, the code the plugin generates comes with error and I've tried phpmyadmin and sql pro with same error SELECT wp_bp_xprofile_data.value, ...
0
votes
1answer
47 views

Wpdb empty result only if language is Russian

I'm having a little problem with wpdb query. I need to change content of an HTML select by changing another one ( simple and clean ), so, this is my query: $_queryString="SELECT stato_"....
1
vote
1answer
87 views

post loop causes wp_users and wp_usermeta DB queries for each users

Continuing my previous question: My post loop produces 2 queries per post: SELECT * FROM wp_users WHERE ID = '53' require('wp-blog-header.php'), require_once('wp-includes/template-loader.php'), ...
1
vote
1answer
151 views

Date query year and month OR just year

I am a bit stuck with setting up this date query. I am using a dropdown select box to allow the user to choose which date archive they want to view. It works for the months, but when I select the year ...
0
votes
0answers
40 views

How to exclude child page on siblings and parent page in WordPress?

I'm trying to hide details about a child page when I'm on the siblings and it's parent page and I don't know how. What I made is exclude the child page details when I'm on it. I want to exclude the ...
0
votes
1answer
142 views

How to get thumbnail with pure PHP in a Wordpress database?

I need help to get thumbnails in a WordPress database with pure PHP because a need insert this in a Magento Application (Feed). Can someone help me? I need this: http://luckifas.nextmp.net/wp/wp-...
0
votes
0answers
26 views

Query posts in current category but not attachment format

In my category.php i want to query posts in the current category but are not in post formats attachments. How do i achieve this? I currently have the below code that displays all the posts in the ...
1
vote
1answer
27 views

Query metas (and not : query posts by metas)

If I understood well, the WP_Meta_Query from Wordpress allows you to query posts by metas. But what I would like to do is to fetch metas; not posts. And I would like to fetch those metas without any ...
0
votes
1answer
21 views

Get multisite count without php?

I'm writing a program in Python that outputs information about Wordpress installations and I'm adding some features to detect Multisite installations and their details. I would like it to print how ...
1
vote
2answers
160 views

Query All users that has post

I have this query so far : $user_args = array( 'role' => 'frontend_vendor', 'orderby' => 'display_name', 'order' => 'ASC', ...
0
votes
0answers
102 views

Show posts by tags excluding current post

I'm having some trouble trying to display current posts by tags and not adding the current posts. Here is my work in progress and I'm using a custom post type. I'm not exactly sure on what to add in ...
0
votes
1answer
28 views

how to replace old DW site with new WP site? [closed]

I'm new to Wordpress.org. I have an old Dreamweaver website that I want to replace with my new Wordpress.org site, using my same original URL. How do I do this? I need simple, easy-to-understand ...
0
votes
0answers
179 views

How to get user by display_name with WP_User_Query

I'm using WP_User_Query to get user by display_name and other columns such as: user_login, user_nicename. Here is the code: $my_users = new WP_User_Query( array( 'role' =&...
0
votes
1answer
69 views

Filter posts/pages by user_role array

I have made a code for to filter wich pages to show depending on your user_role. Everything was alright. But my customer created NEW roles with similars name/slug. So now, if some 1 have the role ...
0
votes
2answers
133 views

Query post for today, if no post get the previous one

EDIT : I answered myself. Simple request for you. I am trying to develop a code that search for post for TODAY. If it returns nothing, then get the latest post before today. For now, I have made a ...
1
vote
1answer
34 views

Storing Array from returned database query and using the array in a new query

I'm currently storing results in a variable from a db table like this : $followed = $wpdb->get_results("SELECT user_id1 FROM wp_um_followers WHERE user_id2 = 1", ARRAY_A); This returns an array ...
1
vote
2answers
574 views

Possible to get posts from multiple meta keys/values in a single query?

Say I have a bunch of posts, some of them have a meta key called "key1" and some of them have a meta key called "key2". But the posts do not have both. I'd like to create a custom query which ...
0
votes
1answer
87 views

Limit tags shown in post

How do I limit the number of tags shown using the code below, without having to add $count=0; or if ($count <= to the query, but only for the home page, and a different number for each set of post?...
0
votes
0answers
41 views

How to obtain a list of root-level menu items that have children?

I'm working on an admin panel that offers some minor customization for nav items that have sub-menus - naturally, to that end, it would be really handy to get a list of all root-level menu items that ...
0
votes
0answers
207 views

How to execute a SQL-query which contains multiple queries using $wpdb->query?

I want to execute the following Query-String, which contains 2 separate queries using $wpdb->query: CREATE TABLE `foobar` ( `id` int(2) NOT NULL AUTO_INCREMENT, `foo` varchar(22) COLLATE ...
0
votes
1answer
79 views

WP_Query always returning the last custom post

I have code that works fine on our live system, and I'm porting it to a new theme. In the new theme, the WP_Query always seems to return the last custom post. My function is: function ...
0
votes
0answers
37 views

2 different templates for 1 query

I have a working query with some custom meta fields (among others ACF Gallery field) which displays news on "News" page. I have also second page named "Gallery" which is quering posts by gallery ...
4
votes
1answer
1k views

Random post, once per day

I have a custom post type 'quotes' and I would like to display a random entry on the homepage each day. This is the code I currently have to display the content: <?php query_posts( '...
0
votes
0answers
37 views

Querying same column twice with wpdb (for postmeta values, specifically latitude and longitude)

I've seen similar questions around, but I just can't apply them to my case, I'm quite new at this, apologies. I'm trying to create a google map of my posts, using a latitude and longitude that are ...
1
vote
1answer
195 views

How many queries are normal to execute on a WP site?

I use the following PHP code in my theme's footer. <?php echo get_num_queries(); ?> queries in <?php timer_stop(1); ?> seconds. Then I realized that about 140 to 210 queries are ...
0
votes
1answer
23 views

WP_Query secondary query failing

I'm needing a couple queries on front-page.php and am at a loss why this is not working. My first query works fine, however, my second one specifying the category (or even nothing at all) never ...
0
votes
2answers
144 views

Get Posts that are in the current month or later

I have a custom post type that is an Event. I'm trying to query those Events and only return Events that are in the current month or later. So the event could be in the past, but it has to be in the ...
0
votes
1answer
81 views

Run an update query in a function

I need to run the below in a function, it updates my database if certain conditions are met. I can't get it to work and I can only assume its because of the "SET @newnum" at the beginning. I've echo'...
0
votes
1answer
18 views

What is the best way to query posts based on live data?

I work on developing plugin for WordPress. In each post, there are rating bar that users can rate 1-5 star to post. I calculate the grow rate based on (Stars in past 7 day from now). I want to show ...
0
votes
1answer
59 views

Get list of taxonomies associated with users

I've seen Justin Tadlock's post on creating taxonomies for users, so I know that it's possible to do that. But how do you get a list of all of the taxonomies associated with users? For posts and CPTs ...
0
votes
0answers
33 views

How to search posts by title, id and author? [duplicate]

i am getting the details from a custom search with the below query from a parameter $_REQUEST['search'] in the URL $custom_args = array( 'post_type' => 'post', 'posts_per_page' => 5, ...
0
votes
0answers
57 views

Filtering posts in query

I might be way over my head with this one, but I'm trying to get WP to filter posts by two taxonomies (categories & kategoriat) and one custom meta value (date), so you can filter between dates ...
0
votes
0answers
27 views

Is it possible to use an OR (instead of AND) between tax_query and s (search) in a query?

In the following example: $search = 'thing'; $query = new WP_Query(); $query->query( array ( 's' => $search, 'tax_query' => array( array( '...
0
votes
0answers
57 views

Displaying multiple custom meta fields on the fronted

I am trying to simplify how I display multiple metabox entries on my front page through a custom theme panel. As of right now I have a custom panel called explore which is programmed in my custom ...
0
votes
0answers
94 views

Fake post on the fly with ajax

I would like to generate one fake post on the fly in the admin panel. My aim is to use fake content to retrieve the_title(), the_content(),the attachement url,... I will use this to display different ...
0
votes
1answer
127 views

merge two query arguments into one WP_Query call

I'm overriding WooCommerce's default search query to include searching by SKU as well. // default search query $query_default_search = new WP_Query( array( "post_type" => "product", ...
0
votes
0answers
62 views

How to get query results for the next page

How to get query for posts from next and previous pages on Blog via ajax call? I'm thinking about making copy of the current query with offset like this: $curr_query = new WP_Query( array( '...
0
votes
1answer
112 views

Custom Select Query pagination not working properly

I have Custom Select Query joining two tables and displaying events older than current date. Everything works fine until I try to paginate it. <?php global $wpdb; $date = date("Y-m-d");...
0
votes
1answer
476 views

Custom select query two tables by a meta key

I'm using an event plugin which creates wp_ftcalendar_events table in database with start_datetime column. Here's image of whole table: I want to query my posts by start_datetime. I know that I can'...
0
votes
0answers
29 views

Sorting taxonomies by count of posts with another taxonomy

I'm trying to create a widget that does the following: We have 2 taxonomies here, "brands" and "topic" The widget is supposed to display the 8 brands with the most posts in "topic" on the "topic" ...
0
votes
1answer
86 views

Include custom table in query

Im using event calendar plugin where I can set event date for posts and it shows in calendar widget. Everything is working as inteded but I would also like to query post by event date. Problem is ...
0
votes
1answer
77 views

Query Pulling the same post twice

After seeking help and failing, I managed to write a query for Wordpress that does exactly what it's suppose to do, however it pulls the post that it's suppose to in twice. I've stared and stared at ...
0
votes
0answers
55 views

loop all posts by category

I have custom post type and taxonomy. post_type = product taxonomy = Products 2 level of taxonomy. Living room -Sample tax under living room -more -more Kitchen -sample tax under Kitchen -more -more ...