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

learn more… | top users | synonyms

0
votes
0answers
56 views

wordpress page filter problems

Hello I been working on post type filter so I can filter my content for taxonomies type but for what ever reason I can never get it to filter when I click filter public function product_filters( ...
1
vote
1answer
51 views

Rewrite Rules returning wrong data

I have a custom post type called product. It is categorized with the two taxonomies product_category (which is superior) and product_group. I want the permalinks for single products to appear like: ...
0
votes
0answers
71 views

Best way to execute custom page-specific mysql queries

I would like to query a secondary mysql database (not the Wordpress mysql database) with page-specific queries. I've seen many answers / tutorials on setting up a secondary mysql database, like: ...
1
vote
2answers
740 views

Inserting data into `post meta` table?

How would I be able to insert data into the post meta table? I know how querying and wpdb works but I have no idea how I can just insert it into the table. I have these two fields I want to insert ID ...
0
votes
1answer
47 views

About WP's save_post action

Quick question, in API's some times save_post is used(most of the time actually). Is save_post the equivalent of the query action INSERT INTO whereas save_post saves metadata and forces Wordpress to ...
0
votes
1answer
218 views

Query posts from a specific category and selected tag

I am trying to have a page (tag page) with this conditions: query posts from a specific category (for example : products) show only the posts with a selected tag (the tag is variable) not all the ...
0
votes
1answer
105 views

How to SQL query posts IDs by categories AND authors?

I am making a custom WP_Query and I need to come up with a SQL query that gets the posts IDs from X categories and Y authors. Then merge those IDs and put them in an array. I only need to figure out ...
0
votes
2answers
88 views

Wordpress and a secondary database?

I have to achieve something on which I don't know how to approach it. Base of the issue: There's a bunch of data in another DB that I have to import into WP which so far wasn't possible due to them ...
0
votes
1answer
49 views

Custom types, taxonomies and query optimization

I'm doing a re-design and re-coding of a fairly large Wordpress website. As part of it we're adding some different post types representing various data types (website will have additional data-driven ...
0
votes
2answers
37 views

Include both default and Custom Post Type in query modified inside pre_get_posts

I want to include custom post type in the author arhive page. I tried the method discussed in this post: Including post_type = 'wiki' in author archives add_action( 'pre_get_posts', ...
2
votes
1answer
110 views

Custom Post order for homepage

I would like to display a dropdown on the homepage which contains [most popular, most recent, trending] and when a user selects on of them the posts are page reloads and the posts are sorted in that ...
1
vote
1answer
55 views

Minimize database queries to user tables?

I'm trying to come up with a strategic way to collect large amounts of usermeta data (and output to the screen) while keeping database queries low. Some pages, like the home page, single pages, and ...
0
votes
1answer
27 views

Connecting to a 2nd DB gives me no results when querying

I'm trying to access a different DB on the same localhost as my wp db is and I did this like so: functions.php: add_action('init','my_new_db'); function my_new_db(){ $newdb = new wpdb( 'test', ...
1
vote
0answers
24 views

Order posts with a custom field but also without

I am querying and ordering posts with this code but my theme adds the custom field (cb_vote_nb_vote) only if someone clicks the "vote" button, since I am doing a listing, posts created without that ...
-1
votes
1answer
13 views

The page that displays Posts on homepage

I want to know the page responsible for displaying the blog posts in WordPress. Where I can probably expect to find the SQL query and post rendering so I can edit some stuff by myself.
1
vote
1answer
378 views

Advanced Custom Fields - Query Efficiency

For testing purposes I have edited page.php to have nothing other than: <?php while ( have_posts() ) : the_post(); ?> <h1><?php the_title(); ?></h1> <?php $site_options = ...
0
votes
1answer
30 views

Continuous listing from a custom field

I have posts with custom fields called "cb_vote_nb_vote" which holds the vote count for every post, what I want to do is let's say posts under A category will be listed based on vote count, I do that ...
0
votes
0answers
48 views

Working with arrays/foreach statements - echo results? Addition operator w/foreach… multiplying?

I'm really struggling with this - I'm relatively new to PHP but I'm trying make this code that I've pulled together output a list of chapters sorted by user pageviews based on a user_meta field called ...
0
votes
2answers
367 views

Undefined variable: row?

I'm trying to select the post_title from wp_posts with a query which I did using this method: global $wpdb; $test = $wpdb->get_var( $wpdb->prepare(" SELECT post_title FROM ...
1
vote
0answers
148 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
40 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
92 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
163 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
104 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
119 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
59 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
602 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
52 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
42 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
56 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
46 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
27 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
458 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
1k 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
209 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
131 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
263 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
50 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
194 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
33 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
47 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
289 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
130 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
61 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
42 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
22 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 ...