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

learn more… | top users | synonyms

0
votes
1answer
9 views

Modifying date filter on admin page for custom post type to link to custom field

Apologies if a similar question has already been asked, but I can't seem to find the exact functionality I am looking for. Basically I have a custom post type (sermons) which has 'recorded_date' as ...
1
vote
1answer
18 views

Temporarily storing main search result

I have several different post types and when someone searches, it lumps all the post types together and then I have a drop down select for the user to refine their search by the different post types ...
0
votes
0answers
11 views

Search returning everything

<div class="page-head"> <h2 class="page-title"> <?php if ( have_posts() ) : ?> <?php printf( __( 'Search Results for: %s', ...
0
votes
0answers
14 views

Reorder results of select query by distance

What I'm trying to achieve is a store directory listing nearby stores, ordered by distance. I've managed to grab all the stores within the specified radius and display them, and also calculated the ...
0
votes
0answers
7 views

Filter query posts by the count of metas for a meta key

I know it is possible to filter queries to order posts by the numeric value of a meta. For example, I store the number of total likes for a post in a single meta key : ...
0
votes
0answers
12 views

Query post by category using only one custom page template

Is it possible to query a post by category using only one custom page template? Basically I created a custom post called "Vehicle" and each post are assigned to a different a category. Instead of ...
0
votes
0answers
15 views

wpdb giving different results then query in SQL Editor

I'm trying to read candidates and the relation with expertises from 2 custom tables in my WP Database. This is my WPDB query : $candidates = $wpdb->get_results(" SELECT * FROM ...
0
votes
1answer
23 views

Include posts from feature category in pre_get_posts

I have two custom taxonomy 'cities-taxonomy' and 'userfeed-taxonomy' and I am excluding all the post which has these taxonomies assigned in my blog page using pre_get_post(); Here is my query ...
0
votes
1answer
17 views

pre_get_posts with get_posts

So in the template I've multiple featured posts and sliders and 2 default loops. I use get_posts for everything except default loops (obviously). Now the issue I'm having is excluding get_posts ...
0
votes
0answers
17 views

MySql query to retrieve post_title, post_content and feature image link BASED ON A CATEGORY

I have been trying for quite a long time to retrieve post_title, post_content and feature image link for all posts BASED ON A particular CATEGORY, from a wordpress database. I have got a query: ...
0
votes
1answer
22 views

How to reset usual $query on search page to push custom $wpdb query there?

I, recently posted 2 questions (First, Second) with no answer. I found my solution for both of them. But now it's time to fine-tune things. If I can fine-tune here, I could answer both the questions. ...
0
votes
1answer
18 views

Why my query does not run with prepare

Hi Below is my query and it works with prepare keyword on the localhost but whenever I use prepare keyword with my queries on live server the data does not show up and as soon I remove prepare from ...
0
votes
1answer
15 views

How to pass menu slug as a variable to wp_nav_menu?

I need to show a menu depending on what user selects on Page Options. I take menu name from a user to a variable and now i need it to parse through wp_nav_menu. Im trying it like this but it doesn`t ...
0
votes
1answer
16 views

How to enqueue assets only on queried pages, excluding the page being queried?

How can I enqueue scripts and styles ONLY on admin pages that have a query attached to them? I have the code below which works, but it also enqueues on the native page of the query. I want to ...
0
votes
1answer
32 views

Multiple terms not working on taxonomy

I need multiple terms support my WordPress theme - $boards = get_user_meta($user_ID, '_Following Board ID'); $pboards = get_user_meta($user_ID, '_Board Parent ID'); $paged = (get_query_var('paged')) ...
2
votes
0answers
42 views

Custom WP_Query order by post_meta and (author) user_meta

I am having an issue that i couldn't find on google and elsewhere. To put problem in the context. I am making a wordpress site where user can put their tutor listing for giving a tutorials, and i am ...
1
vote
1answer
50 views

How to show only posts with images?

I want to hide posts without images on the front page, so I need get an array of ids of those posts. I know how hide posts on the home page by id, but I need to show only posts with images. This is ...
0
votes
1answer
10 views

query_posts that have custom taxonomy and limiting what shows based on the taxonomy

I have a custom post type, technologies, that has a custom taxonomy defined for it, importance. The idea is that a technology that has any significance will get importance tagged on it (featured is ...
0
votes
2answers
29 views

How to query the WordPress database to get posts of a certain custom post type, taxonomy and field?

I have a custom post type named store and I have a custom taxonomy city, I also have a meta box with a field that is stored with update_post_meta( $post_id, 'store_postal_code', $postal_code ); it ...
0
votes
0answers
15 views

Can I merge WP_Query and WP_Comment_Query together?

I have read about merging two WP_Query results. But I need to merge a WP_Query with a WP_Comment_Query and order the result by date. Is this possible? If so, how can I approach this? How would I ...
0
votes
0answers
9 views

Change the number of attachments loaded into the Media Popup window

I wish to ask if is there a way to change the numbers of thumbnails loaded in the media popup when it first opens. The Media Popup loads thumbnails through ajax (query-attachments), executing up to ...
0
votes
2answers
16 views

Media Query - Display Upload Author & Get Uploaded Yo Post ID

Working on a project with a lot of galleries & "attachment" post type queries. It's all working great except I noticed in the Attachment Details box in the admin dashboard that Wordpress stores ...
0
votes
2answers
67 views

Ignore sticky posts if post is not in meta query

I have such a wp query args: $args = array( 'post_type'=> 'myposttype', 'posts_per_page' => 10, 'meta_query' => array( 'relation' => 'AND', array('key' => ...
0
votes
2answers
122 views

Create a post builder skin in a plugin

Currently I'm working on a plugin that will display a grid based on post type with many settings to customize it. One of the settings will be to choose between different skins available to display ...
0
votes
1answer
45 views

Filtering custom posts by custom fields (ACF) [closed]

I'm working on a site with photo contests. Each contest has a lot of additional info, which I store in custom fields (thanks to Advanced Custom Fields). Now I want to search through contests filtering ...
0
votes
1answer
48 views

Search Functionality broken by the wp 4.2 update

I run a blog site with posts by authors, and I implemented a search that would return results if the search was like an author's name or the search term was contained in a story. I was functioning and ...
0
votes
0answers
15 views

How to move posts in featured category on top and keep pagination

I want to move every post from category_id = 11 and 10 on top of the list and then query every other post which is only in 10th. I thought that making two loops will do the trick but there is a ...
0
votes
0answers
33 views

Command to make Woocommerce product variation price the same as its parent product price

The variations are stored in the wp_posts table like the products, but they are related to the parent product itself somehow. I just wanted a command to make all products variations prices same as ...
0
votes
1answer
26 views

When add_query_arg() is necessary?

considering this code, both solutions seems to work fine. What I don't get is, is there any difference between the two solutions? general_plugin.php function add_custom_query_var( $vars ){ $vars[] ...
0
votes
1answer
99 views

add_query_arg() XSS Vulnerability

I've created a personal plugin and now I'm worried about this vulnerability: https://blog.sucuri.net/2015/04/security-advisory-xss-vulnerability-affecting-multiple-wordpress-plugins.html This is how ...
0
votes
0answers
12 views

Wordpress URL strings for filtering posts by category

I'm working on quite a large blog based site specifically on creating a category navigation system designed to display posts based on multiple category queries. I'm doing this using URLs such as ...
0
votes
0answers
32 views

Override default posts per page in taxonomy template

I am using the following code to show ordered list of posts in taxonomy page: <?php $mypage = (get_query_var('paged')) ? get_query_var('paged') : 1; $ppp = get_query_var('posts_per_page'); ...
1
vote
2answers
62 views

Looping through posts per category gives same posts for each category

For a specific section on my website I loop through some categories and get the three latest posts in that categorie and list them. Like so: <?php $categories = get_categories(array('exclude' ...
1
vote
1answer
16 views

Are database queries created using WordPress filters protected from SQL injection?

I'm using the WordPress 'posts_where' filter (https://codex.wordpress.org/Plugin_API/Filter_Reference/posts_where) to alter my queries as below: function filter_my_search($where=''){ ...
0
votes
1answer
25 views

Display list of most recent grandchild (third tier) pages

I currently have a piece of code I'm using to display a list of the three most recent 'special' custom post type posts which will display an image, title and content of these posts. I'm trying to ...
0
votes
0answers
16 views

Query for distance OR taxonomy term

I'm using a custom query to retrieve posts with geo-coordinates within 10 miles of user coordinates and order them by distance. The query works as intended without issue. However, my client now ...
4
votes
1answer
58 views

WP_Comment_Query pagination, delving into the unknown

I am aiming to pagination WP_Comment_Query(). It appears this is either taboo or there is no viable information about it online, not anything. Why? Is it possible? If so, how?
0
votes
0answers
13 views

how to get Tag in menu populated with recent posts submenus

I would like to know if it would be possible to implement an option to "populate" each tag menu items of my WordPress site automatically with links to recent post as submenus. In other words, when ...
0
votes
2answers
24 views

Different values for get_author_posts_url and get_the_author (posts 2 posts)

Caveat- I'm not a programmer, I'm a designer that has taught myself basic php/wordpress theming. This is a very specific question, I realize, but I'm hoping the experts can help me find some ...
0
votes
1answer
29 views

How to convert query sql to shortcode in wordpress?

I want to make a shortcode like this [myshorcode:2:drinks], and query-wrangler I have managed to get the following query that shows me 2 products of a certain taxonomy PHP WP_Query: $query = array ( ...
0
votes
0answers
19 views

How can I show latest posts from certain tags menu items as submenu?

I have the following order of menu in the menu dashboard: Category1 ->tags(related to category1) category2 ->tags(related to category2) etc.. when you hover a tag menu item I want to get the list of ...
0
votes
1answer
10 views

Issue attempting a wp_query_posts with tags

Having an issue trying to query the most recent posts using the tag, in this case, trending. I used the following code but I get no results. If I switch out 'tag' to 'post_type' it will work: ...
0
votes
1answer
27 views

Function returning queried meta value based on current post ID

I have written several queries which sums download counts grouped by the post they are associated with, and other relations. They work great for exporting to CSV and other uses outside of WordPress, ...
0
votes
2answers
64 views

Wordpress SQL injection

How to make below code safe from sql injection ... I am working in wordpress. global $wpdb; if($wpdb->insert( 'votes', array( 'votes' => ...
0
votes
0answers
10 views

Custom short code pulling all tag IDs instead of selected ID

My server host recently detected malware in a script and deleted the files, causing the audio player plugin on my website to go bye-bye. I'm trying to restore but now the custom short code I wrote is ...
0
votes
1answer
20 views

Missing posts in a query

I've got this loop where I need to grab a custom post type, get a taxonom, then for each term in taxonomy I need to output all posts. They are all output in a gallery, where taxonomy term is the ...
0
votes
0answers
12 views

MySQL database insert no more works

I am working in wordpress and below is my code which has a form tag in a for loop and the submit button. When submit button is clicked an insert operation needs to be performed but the insert function ...
0
votes
1answer
57 views

Wordpress loop not working on static front page

I have a static wordpress front page. I want the code that works on my regular blog template to work on the homepage too. Currently, it only shows one post. The code in the main index.php is this... ...
0
votes
1answer
29 views

get query() without post content?

Is there a way to get query with post information (thumbnails, id, etc.) but without the_content()? I already have plugin to show recent posts in sidebars at homepage and when it is for example 20 ...
0
votes
0answers
29 views

Strange problem with wp_get_attachment_image_src database (db) query count

I have a purchased theme that has a custom WordPress loop in it that looks for image attachments via wp_get_attachment_image_src. It does this by doing the following: $image = ...