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

learn more… | top users | synonyms

0
votes
1answer
16 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
12 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
19 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
17 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
13 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
36 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
23 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
13 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
8 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
61 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
38 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
44 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
30 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
96 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
11 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
27 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
60 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
55 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
20 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
28 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
18 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
25 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
9 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
19 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
51 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
28 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
26 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 = ...
1
vote
2answers
76 views

Get next and previous 3 posts in a term in single post page

I have a the following Custom post type: episode Custom taxonomy: series sub terms real deal -> season 1, season 2, season 3, etc. The terms are hierarchical, and the entire thing is ...
0
votes
0answers
15 views

Create multiple taxonomy archives from the same tax and link term-links to them based off of the unique query

I have a CPT called "Clinical Trials." There are three taxonomies associated with "Clinical Trials" —"Locations", "Cancer-Types", and "Status". I have a query set up to return a list of all ...
4
votes
3answers
283 views

The correct method to pass query vars in AJAX using ajaxurl

OK, I had no idea how to title this topic. I'm trying to override the default behavior with ajax. The problem here is not actually a problem, but a wish more. I have this url: <a ...
0
votes
1answer
33 views

Finding the next 5 posts

On my single.php where I am calling my post I am wanting to run a query where I can catch the next 5 posts (chronologically). I know how to do everything except figure out a way to specify the 5 ...
0
votes
2answers
34 views

Sort Wordpress Posts Meta value by Week not Day

Right now I have a metakey called 'epicredvote', it sorts my posts by this epicredvote number. It is doing it on a daily basis at the moment, so if I have 2 posts the post with the highest epicredvote ...
0
votes
0answers
18 views

WordPress Query Count

So I've used get_num_queries() and the "debug bar" plugin for a while to monitor the number of queries running against the database. Earlier today I turned on the MySQL query log for an unrelated ...
0
votes
0answers
17 views

meta query always fails even if data is correct

I've following query - $query = array( 'post_type' => 'accessory', 'posts_per_page' => -1, 'meta_query' => array( array( 'key' => 'accessory-bike', ...
0
votes
2answers
74 views

list all categories that have a certain word in title

How to list all the categories that have a certain word in title - first word of the category? in category.php so, for example, if I am viewing the category "Green Apples Sells", it will list all the ...