Tagged Questions

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

learn more… | top users | synonyms

0
votes
0answers
134 views

MySql Query very slow

I have a problem with a query on my website. When I load the page it is incredibly slow and only after over 12 seconds the content starts showing. I have installed a debug plugin and found the query ...
0
votes
0answers
38 views

Proper way to trigger a MySQL query via link in a plugin

I am trying to develop a module in my WordPress plugin that will delete an entry from the database. The only issue is related to the trigger action. I've tried to send my users directly to the page ...
0
votes
1answer
78 views

WP MS: How to query over the network

I have a WP 3.8.1 Multisite installation with 3 blogs, they're all in one db, prefixed wp_, wp_2_ and wp_3_. In a template in wp_ I try to to display all posts from wp_, wp_2_ and wp_3_ which have a ...
1
vote
3answers
145 views

How to echo excerpts with wp_list_pages?

I've tried to echo excerpts in wp_list_pages with the code below. It works, but only for one of the child pages. How would I echo the excerpt and title for each child page? <?php $children = ...
0
votes
3answers
102 views

How to show more than 5 posts?

I am running code that shows child categories, and all posts in the child categories. But if there are more than 5 posts in a category, only the 5 newest are shown. How can I show all, or at least ...
2
votes
1answer
118 views

How can I display a specific user's first published post?

I'm looking for a way to display a user's first published post using their unique ID. I have a function that calls a list of specific users using their IDs, and would like to display the date the ...
0
votes
0answers
52 views

Query custom post type by date field only working when two posts match the query

Hi I am trying to query a custom post by an advanced custom field that is a date field and this is how it is registered in a plugin that I have created to take care of all non-visual aspects of the ...
0
votes
1answer
490 views

insert query on a custom table using ajax with jQuery plugin Jeditable

I've read tons of post already but found no solution... I'm tryin to implement Jeditable functionality in a plugin with this code: jQuery(document).ready(function() { ...
0
votes
0answers
40 views

Update the values from specific custom fields for 70 pages

I have a wordpress site with more than 70 pages of different brand car offers. Each page has a custom field named Price with a numeric value. This is what I got so far: function ...
0
votes
1answer
47 views

Query Only Show Text on Posts With Certain Taxonomy Tag

I am trying to query in a post to show a fixed line of text at the end, so that if that post has a specific taxonomy tag applied to it (Special), then a line of text will show. I guess it's something ...
0
votes
0answers
40 views

$wpdb: how to use a query as a base for another query?

I've got this query: select p.ID, p.post_title, p.post_content, t.term_id, tt.taxonomy, t.name, t.slug, tt.count from bdu_posts p inner join bdu_term_relationships rel on p.ID = rel.object_id inner ...
0
votes
1answer
55 views

Query the database after get_header() has been included

I'm trying to create a custom template. Iv'e searched a lot but cannot find how to query the database once the get_header() is added to the page. What I am looking for is for PROPER ways to query ...
0
votes
0answers
44 views

unable to join tables and display correct result

I'm using multisite for a real estate agent association and I have a plugin that will get all listings within the network and post to main site as a post, plugin is working great; the plugin used to ...
0
votes
1answer
26 views

Custom Same Page Search

I've added a custom form to one of my page templates. It submits to itself $_SERVER['REQUEST_URI'] in hopes I can grab the $_GET values and modify my query using pre_get_posts, but instead it goes to ...
0
votes
0answers
414 views

Query multiple taxonomies plugin with ajax, archive loading posts outside filters

I have a custom post type called jobs and within I have several taxonomies: Job type (full-time, part-time, practice, etc), Country, Job Area (design, development, etc). I'm using the plugin from ...
0
votes
1answer
959 views

meta_query on a date range using an array of values

How can I do a query to return the post if the custom field array contains a date that is within the specified range? The query below is basically what I am after but it does not work... // the ...
0
votes
1answer
17 views

meta_query dates from an array

I have the below query which isn't returning anything. The query is meant to look for the date (2014-03-01) that is in the array, which it is. Any ideas? Or would I need to use a custom SQL query? ...
-1
votes
3answers
183 views

How to perform a search inside a specific taxonomy category

My problem is this: I have 3 custom taxonomies, let's say 'author', 'title' and 'editor', each one applied to regular posts. Let's say I have post_1 that has in the 'author' field 'jorge borges' and ...
0
votes
1answer
122 views

Run search query again without pagination gives no results?

Update: This question isn't really relevant anymore. I switched some code, so now the filtering works. Looks like the query wasn't working, because I triggered the indexTaxonomyCounts function from ...
0
votes
1answer
248 views

Querying Advanced Custom Fields

I've been back and forth with this and not able to get my Advanced Custom Field query working. According to the documentation in the link above, this is what my array should look like: $args = ...
0
votes
1answer
2k 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
0answers
47 views

Get current terms info when querying by multiple taxonomy terms

I'm currently using the following in my archive template to create a menu of taxonomy terms and add a 'live' class to the term that's currently being queried. $termsA = get_terms('MYTaxA', array( ...
0
votes
0answers
192 views

$wp_query->max_num_pages

I have a pbd-ajax-load-posts plugin, and I'm using the portfolio. But $wp_query->max_num_pages is 0 - why? My pbd-ajax-load-posts.php code is: <?php /** * Plugin Name: PBD AJAX Load Posts * ...
1
vote
1answer
32 views

How can I setup a relationship using categories in WordPress?

I am trying to setup a relationship between a "People" post type and a "Work" post type. For example, I want to have a structure like this Person 1 - Work - Work 1 - Work 2 Person 2 - Work ...
0
votes
1answer
46 views

404 for children in hierarchical custom post type

I've tried all the solutions I can find on this and I'm still stuck. This post has a good thorough approach to debugging, but it hasn't helped. Part of the issue may be because I'm trying to get the ...
1
vote
2answers
262 views

Get comment content by comment ID

So I've been trying for a hour or so now to list comment by it's ID. I've tried the get_comment($id, $output) function but it didn't work well, so I went back to whatever is shown below, but it just ...
1
vote
1answer
123 views

Query Wordpress database by registered date and role

I would like to get the display name and email address for all users who have registered to my multisite today with the role of subscriber. It needs to be an SQL query as it's used outside of the WP ...
-1
votes
1answer
56 views

paged query leads to 404? [duplicate]

As soon as I click the "2" on my pagination links I get a 404-error. The url correctly changes to http://mysite.com/?paged=2 <?php /** * The loop that displays the posts. */ ?> <ul ...
0
votes
0answers
40 views

How Can I Put Meta_Compare in the Database-Query?

Yes, I know that this can easily be done with built in wp_query but I need this in Wpdb query. I have a custom field and I need to display posts where this field does not exist. By the way can I get ...
0
votes
0answers
9 views

Reduce repetitive code filtering custom post type categories [duplicate]

in category.php I have: if ( is_category('cat-1') ) { $the_query = new WP_Query( array ( 'post_type' => 'mueble', 'category_name' => 'cat-1' , 'posts_per_page' => 3 ) ) ; } if ( ...
0
votes
0answers
21 views

query custom post type and order by most comments within one week

Hi I'm having a lot of trouble with my custom query... I had it working just fine, displaying all posts of a custom post type and ordering them by most comments within a single week. But since I ...
0
votes
0answers
288 views

SQL Query to select post thumbnail, post title, post content from a category

I use the db of my wordpress blog to develop a mobile application in Java. For this, I need the SQL query to display the thumbnail of a post, the title and the content in a selected category. I think ...
0
votes
1answer
85 views

Multiple Queries and Loops within CPT Archive

I have a Custom Post Type called 'properties', and have set up an Archive page to display posts within that category. Essentially, the Archive page needs to contain 3 different query types; the first ...
0
votes
1answer
338 views

why category__and and category__in wont work togather?

I am having an issue here. I want to get all the post that are related to the current post at the same time it will also have a common category term. for example: Post XYZ has categories car, Truck, ...
0
votes
1answer
33 views

Sort post by last commented

I tried this : <?php if ( have_posts() ) : query_posts(array('orderby_last_comment' => true)); ?> But it's not working
-1
votes
1answer
52 views

How to insert a variable into a query parameter?

I need to put a variable into query parameter. I have this situation: $variable = get_field(loop_category); $catquery = new WP_Query( 'category_name=***VARIABLE-HERE***'); ...
0
votes
2answers
246 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
80 views

Wpdb generates too many queries

I googled for hours, then found some codes on stackexchange (http://wordpress.stackexchange.com/a/108279/108270) and created the codes below. I'm trying to get alphabetical A-Z posts lists (e.g. A B C ...
0
votes
1answer
78 views

Get blog id of subdirectory multisite blog from name - *outside* of wordpress request processing

I have a Zend Framework 1.11.1 MVC application that has Wordpress 3.7.1 installed as a subdirectory multisite network below its "public" directory. It uses must-use plugins to ensure that only ...
0
votes
1answer
531 views

How to return count of custom post type posts with a specific custom field value via $wpdb?

I am trying to get count of a custom post type with a specific custom field value from wpdb without doing a WP_Query or get_posts since I think it is more resource efficient and I need to return 10 ...
0
votes
0answers
53 views

Query post names based on tags of current post

I have a custom post type called 'employer'. In some of my normal posts, I use the slug of an employer as a tag to link the two together. For example POST A mentions "Adidas" and therefore I add ...
1
vote
1answer
391 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
2answers
42 views

Unable to paginate a custom page query

I have this code on a page called Categories. <?php /* Template Name: Categories */ get_header(); ?> <section id="primary" class="content-area"> <main id="main" ...
0
votes
1answer
217 views

Taxonomy filter under Polylang

The filter code below is from Themeskingdom Exclusy theme. It makes a sql query for posts ids and then queries the taxonomy terms associated with those posts. I then uses isotope jquery plugin to ...
1
vote
1answer
143 views

Should 'setup_postdata()' be reset with 'wp_reset_postdata()'?

Starting with an example makes more sense, so here's an example function: function seo_meta_tags() { global $post; if( is_singular() ) { setup_postdata( $post ); ...
0
votes
1answer
131 views

Divide WP_Query posts by date & post type

I have a WP_Query that divides 2 Posts types by date but the functionality is not there. Currently it outputs the dates and posts on the same level like.. -Date -Post -Post -Date -Post -Post What I ...
0
votes
2answers
61 views

If Elseif Query

I'm trying to work this query - the first if clause works, and the else works, but the middle clause, elseif, doesn't work. <?php if(get_post_meta($post->ID, 'TourURL', true)) { ...
1
vote
1answer
149 views

example of build_query function?

I have this resource: (http://codex.wordpress.org/Function_Reference/build_query), but it does not give full example. I have this URL: mypage/?page_id=87 and this array: array('name' => 'me') ...
1
vote
1answer
67 views

Only display a certain number of posts, dependent on how many posts there are available in a query

I am trying to write some code for a slider of posts, at the moment my code involves two WP_Querys, one inside the other, but I can't help feeling there may be a more efficient way of doing what I'm ...
0
votes
1answer
313 views

How to display data from db in select list [closed]

I wonder what it's wrong in my code. I can't get all of data in column "adres". In result I only have the lest record. Thanks for help. global $wpdb; $result = $wpdb->get_results ("SELECT ...