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

learn more… | top users | synonyms

0
votes
0answers
3 views

Partial text search custom taxonomy

I am trying to do an autocomplete field that interrogates the database finding a custom taxonomy but can't seems to figure out how to achieve this. Would i need a custom query?
2
votes
2answers
20 views

$args numberposts variable

$args = array( 'numberposts' => '10', 'post_type' => 'newposttype'); $recent_posts = wp_get_recent_posts( $args ); I know it's not a simple thing to ask but how could I set the numberposts ...
0
votes
1answer
26 views

Using WP_Query to re-query and sort results using a date?

I'm writing a function to find the users next upcoming event (stored as CPT), chronologically. If I use a normal query and do something like 'post_type' => 'ticket', // another CPT set up to act ...
0
votes
1answer
16 views

How to get to a specific position in wp_query?

Background: I'm trying to display images in a slideshow, and I want to select those pictures randomly from the website's media. The image has a custom field in order to be selected for being the ...
0
votes
0answers
18 views

Wordpress search query

I used code snippet, from the plugin http://wpadvancedsearch.com/, which works very well, but when I press a search button, it generates the following string in the URL: /?search_query=& and I ...
0
votes
0answers
17 views

Optimising specific Query with ACF meta objects

Is there any way I can improve the following query without touching the server, as it's taking around 5-6 seconds to execute, the SQL is outputing as: SELECT wp_posts.* FROM wp_posts INNER JOIN ...
0
votes
0answers
10 views

custom post types not appearing in Search multiple post types

I have a Search page where users can select to search for multiple post types: posts, pages, docs, newsletter. What is driving me nuts is that: a) Users can select posts/pages OR docs OR ...
0
votes
1answer
29 views

i'm trying to get all my media query attachments via ajax in wordpress

i'm trying to load all my media files via ajax: $.ajax({ url: '/wp-admin/admin-ajax.php', type: 'post', data: { 'action': 'query-attachments', 'post_id': 0, ...
0
votes
1answer
21 views

Display the latest post from some selected authors

I'm building a slider that will display the latest post of a few selected authors. So far, I've written this: <?php $args = array( 'post_type' => 'post', 'posts_per_page' ...
0
votes
0answers
26 views

How do I get a nested query to only display content that the main query outputed

I have a CPT 'artists' and a CPT 'events' I want the 'artists' to query first based off the posts tag and then I want the 'events' to query events based off what 'artists' was queried. Heres what I ...
0
votes
2answers
25 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 ...
0
votes
0answers
18 views

MYSQL sleep process for 20 seconds while site is “waiting for…”

I'm running WP 4.0.1 on an Ubuntu VM server. The server has no outside internet connection, so I have enabled define('WP_HTTP_BLOCK_EXTERNAL', true); in wp-config.php. When I click a link on the ...
0
votes
1answer
31 views

How to detect if query is runned from widget?

I want to know if exists function that detect if some database query run from widget, for example from recent_posts widget or search_widget.
1
vote
3answers
29 views

How to display all posts with today's same month and day only?

I'm trying to figure out how to do this. I have many posts. I want it so that when someone pulls up the site, the front page shows all the posts that were done on the same month and day -- but ...
0
votes
1answer
44 views

Problem on wpdb queries, wp_insert_post, wp_insert_user etc. The query runs twice

Anyone encountered this issue? I have created a custom php script which adds a new post by using wp_insert_post() but everytime I run the code it creates a 2 new post where in it should be only be ...
-2
votes
0answers
20 views

Database connection question

I am new to WordPress and I wondered if it would be possible for me to develop my website using WordPress. I need to be able to implement a feature where users log in and a table is displayed ...
0
votes
1answer
51 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
1answer
19 views

How to query custom post type one after another

I am trying to query my custom post types. I can display both of them with this code: 'post_type'=> array('map','item') But I don't want them to mix. I want "map" to display before "item". ...
0
votes
1answer
53 views

Order posts by tags count?

I am trying to order posts by tag count. I want to order posts with no tags first and posts with highest count last. I tried and got posts with no tags only. $tags = get_tags(); $tag_ids = ...
1
vote
1answer
44 views

How to add posts to wp_query result?

I have 2 user groups: authors and clients Authors can publish posts and specify in metabox for wich client these post is ment for. Client can publish posts and view, edit posts, created by Authors ...
0
votes
1answer
23 views

How to get several fields from wp_query?

I'm going to get several fields from wp_query result. I know about wp_list_pluck() function, but it accepts only one field paramether. How to get several ones if I'd like to take several parameters ...
0
votes
1answer
20 views

Loads posts of different year via AJAX call

I need some advice with this one. I want to load posts of certain years depending what year the user clicks, to achieve this I have the following: <?php $args = array( 'post_type' ...
0
votes
0answers
17 views

Sorting posts alphabetical that have single digits

I have post titles that are like this: Episode 1 Episode 2 Episode 6 Episode 10 Episode 14 I try to list posts alphabetically but it ends up showing like this: Episode 1 Episode 10 Episode 14 ...
2
votes
2answers
32 views

What is the most efficient way of implementing a favorite post system?

I am going to implement a favorite post system so users can save their favorite posts for later reading. I want to know what is the best approach for doing it taking into considaration the ...
0
votes
2answers
29 views

Get the_field of Advanced Custom Fields in a custom query [closed]

I have a custom query to display content of a certain template: <?php $i = 0; $pages = get_pages(array( 'meta_key' => '_wp_page_template', 'meta_value' => 'sale.php' ...
0
votes
1answer
23 views

“Where… like” query not working as expected

I have the following query: $results=$facilities=$mydb->get_results("SELECT facility_name from facility where facility_name like '%".$facility_name."%' LIMIT 0, 10"); It is not working ...
0
votes
1answer
51 views

WP_User_Query. Whats wrong with 'relation' => 'OR'

I want all the users who meet either Condition1 OR Condition2. Sort by last_name. If I take condition1 AND condition2 ('relation' => 'AND'), the query is OK. If I take 'relation' => 'OR', I get all ...
5
votes
1answer
37 views

Is there any difference between hooks posts_where with posts_join and posts_search performance wise?

I want to know which filter hook I should use that performs faster. I did try both several times and I noticed that posts_search is a bit faster than using the combination of posts_where and ...
0
votes
0answers
37 views

Handling Massive Amounts of Data in a Wordpress Plugin

I've been working on my own version of a Youtube Post Importer plugin for Wordpress and I've run into a bit of a wall. I'm using the 3rd version of the Youtube Data API seen here ...
1
vote
1answer
38 views

Add Custom Post Type to Current Query

I'm trying to create a plugin which adds a new custom post type and it should be shown at the same locations as a normal post (front page, archives etc.). Is there any functions for me to retrieve ...
1
vote
1answer
53 views

convert custom query to wp_query

My query is as below $querydetails = " SELECT wposts.* FROM $wpdb->posts wposts INNER JOIN $wpdb->postmeta wpostmeta ON wposts.ID = wpostmeta.post_id INNER JOIN ...
1
vote
1answer
24 views

Alter a specific query on Wordpress

I need to change a query of a plugin that is not the main query. The author did not put any filters. I can see the query from $wpdb->queries Is there a way to access the specific query and ...
0
votes
2answers
26 views

Querying with WP query using meta key price

Could somebody tell me what's wrong with my WP query please? I'm trying to order my posts by price and price is an ACF (a textbox which has a number in it) $args = array ( ...
0
votes
1answer
48 views

Pagination is not working on custom query inside a custom home page template

I know this is a duplicate question. But to comment on existing question, I dont have enough points. So here we go.... Pagination is not working on custom query inside a custom home page template. ...
0
votes
1answer
39 views

How to pull posts into two columns with different image sizes using $counter variable?

I have a custom module pulling one specific category with 6 posts displaying the featured image into 2 columns. I like the first article of the top of each column to display a large image as shown in ...
2
votes
1answer
151 views

If No Search Results, Show Posts from Alternate Search Query

I have a pretty standard loop which outputs "Sorry, No Posts Found" when a search result comes up empty. if ( have_posts() ) : while ( have_posts() ) : the_post(); get_template_part ( ...
0
votes
0answers
37 views

$post breaking container loop

Problem I have a foreach loop grabbing posts inside an advanced custom fields repeater. When it's finished looping through posts it breaks the repeater. I believe the problem is with $post as far as ...
0
votes
0answers
36 views

How to display near by post using latitude & longitude and The Haversine formula

I have a Custom Post Type called "events" that has Advanced Custom Fields "latitude" and "longitude". I'm trying to display all "events" within 75 miles of the user. This is what I have so far: ...
0
votes
0answers
28 views

Popular posts from 7 days loop

I'm trying to create a "loop" which will display Popular Post from a week or any other timeframe. What's the best way of doing it? Also, is it possible to order the posts by views? EDIT: Here is ...
1
vote
1answer
37 views

No results found from a $wpdb->get_results() query when trying to join more than one meta key query

That title was a real mouthful. I have a custom post type called work with three custom taxonomies called work-client, work-type, and work-service. I'm using Advanced Custom Fields to make a nice ...
0
votes
2answers
42 views

Function to limit number of custom post types on homepage - TwentyTen

here is the deal... I got hold of this piece of code to change the default post type shown on my TwentyTen child theme's homepage. It works like a charm when I add this code to the functions.php ...
0
votes
1answer
32 views

shorthand syntax for custom fields

I'm trying to write a shortcode and am sorely out of practice with this stuff. It's for a plugin Full Width Audio Player and I'm trying to query all tracks within a certain playlist so it will output ...
0
votes
0answers
25 views

run search / query from multiple databases

First of I would like to warn everyone, that my skills set in mysql and php is novice. My current wordpress website is based on a network setup (mutli-site), with the help of shardb, I was able to ...
0
votes
0answers
19 views

Compare datetime

I have a query to fetch all the posts that have status: publish and post_date <> post_modified. Query: select id, post_title, post_date, post_modified from wp_posts where post_type='post' and ...
0
votes
2answers
39 views

Custom Wordpress Table wpdb

running into issues querying a custom table and getting results. As of Wordpress 3.9, I can no longer run mysql_query(), and have to use $wpdb->query(); So keeping that in mind: Old Code: <?php ...
0
votes
0answers
28 views

Function to bypass specific words in search?

Is it possible for a word to be skipped/excluded/ignored in the default search? For example if I could make it so that if I type the great thing in the url instead of '?s=the+great+thing' it will ...
0
votes
1answer
89 views

Loop through multiple custom fields with increasing number

I have a problem with custom fields that I have been trying to figure out for a while, but with no luck. I have a section on the site I'm building that let's the users publish content form the the ...
-4
votes
1answer
78 views

WooCommerce Total # orders [closed]

total number (#) of orders, maybe create the function in functions.php and call it in a shortcode anywhere in page. I just don't want to update it.
0
votes
0answers
48 views

Dynamically load content based on Title and Category

After googling for about 2 days now without finding the proper answer - and I must commit that I'm not that well educated in php programming, I hope the community may provide me with the correct ...
0
votes
1answer
26 views

Query pages by child term

I cannot seem to get this to work, I have tried everything I can think of and spent enough time googling, to get me to seek help elsewhere. I need to query pages in a loop, using the same taxonomy as ...