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

learn more… | top users | synonyms

0
votes
0answers
16 views

Function returning same value for all posts

I have this function to get the size in KB from a file. It works like a charm as long as it's on a single post. However, if I do a query, all posts take the value from the first post. Thus, if the ...
0
votes
0answers
5 views

Query Code Making Menu Disappear

I'm trying to display only certain tags on my site, but when I use the code my menu disapears. Heres what I have: $query->set('tag', 'break','crunch'); return $query; I have this placed in the ...
0
votes
0answers
16 views

SQL query works only if inclusive

I have a Wordpress website with, say, 5000 articles. I am trying to apply a query to filter all the posts with featured images not listed in some specific categories. I started with: SELECT ...
1
vote
0answers
23 views

WPDB Multiple site's posts and get featured images

I am using the code below to query 5 Wordpress sites for their posts, merging them into an array, sorting the array by date, and then displaying them: //SITE 1 $mydb = new ...
0
votes
0answers
10 views

Adding Facebook & Twitter Cards

This might be a stupid question.. But I'm working on a website for which I would to integrate twitter/facebook cards and things of that nature. Is there a good way to call those <meta> tags into ...
-1
votes
0answers
18 views

list of recent post by specific tag or taxonomy

<?php $catquery = new WP_Query( 'category_name=s&showposts=10' ); while($catquery->have_posts()) : $catquery->the_post(); ?> <li><a href="<?php the_permalink() ?>" ...
0
votes
2answers
34 views

Query posts between two dates (custom meta keys) CMB2

I have a custom post type (projects) which have custom cmb2 meta keys (str_dte and end_dte), so each project has a start date and end date. What I am trying to do is to get projects between two dates. ...
0
votes
0answers
11 views

Is there an efficient way to query posts's ACF gallery field?

My setup is as below. Custom post type > Page > Custom field (Gallery field) [only one gallery per post] And below is the code that renders all the galleries from the posts on a ...
0
votes
1answer
23 views

Display one post randomly from category on home page

I have a custom post type called "Milo-Books" and a category named "Featured" with ID of "100". I want to run a query which pulls out on post from this category on the homepage, but randomly and I ...
0
votes
1answer
8 views

wp_dropdown_categories with multiple select

in the search box I would like visitors to be able to search for more than one location (houses). The code right now is: <div class="col-md-3 col-sm-6 col-xs-12"> <label ...
1
vote
0answers
17 views

Prioritize posts in query by meta keys?

I have a CPT called jobs. In my single jobs page I am counting page views with these functions: /********* Post Views counter ***********/ remove_action( 'wp_head', ...
1
vote
1answer
32 views

WP Query with custom Shortcode

I have the following in my functions.php:- /** * Shortcode: Latest Properties */ function latest_properties_func( $atts ) { $args = array( 'posts_per_page'=> 5, 'post_type' ...
0
votes
0answers
25 views

Query Custom Post Type that doesn't have a specific Custom Taxonomy [duplicate]

I have a CPT 'catalog' and a custom taxonomy 'catalog_category' attached to it. I need to query for all 'catalog' items, that don't have any values of 'catalog_category' selected. These arguments ...
-1
votes
0answers
18 views

Custom Query Displaying Wrong

I have two custom post types. "Featured Business" and "Business". I have a query which when searched displays the custom post types in order. For some reason it is ignoring my order and displaying ...
0
votes
0answers
18 views

Custom query for tag and custom tag from 2 post type

I have custom post type called items and added custom taxonomies type and sub-type. I like to query posts from both post and items post type that has art as either Tags or Sub type. Below is what ...
0
votes
0answers
10 views

Multiple relationships pods issue

I'm new at using Pods, which I find very practical. I'm experiencing some issues though; I'd like to create a model like the following-one : Entity type 1 |->sub-entity type a, refers to a specific ...
-2
votes
0answers
13 views

Wordpress Load v/s Custom Developed

I am developing custom blog using codeigniter framework. I wanted to have certain information. How much sql query does wordpress run on each load, Assuming, I am using only 2 plugin :- Akismet and ...
0
votes
1answer
12 views

Query for Custom Post Type UI Does Not Loop All the Post

$args = array( 'post_type' => 'lirik_melayu', 'orderby' => array( 'ID' => 'DESC' , ), ); $query = new WP_Query( $args ); $query_contents=Array(); while ( ...
0
votes
1answer
23 views

Query posts according to specific post meta values

I have a loop in my index.php for my home page like this... <?php if ( have_posts() ) : ?> <?php while ( have_posts() ) : the_post(); ?> I have a function to query the posts by ...
0
votes
1answer
15 views

Querying for specific tags

I currently have this code that pulls all of the tags and creates a list with links for them: <?php $tags_array = get_tags(); foreach( $tags_array as $tag) : $tag_link = get_tag_link( ...
1
vote
1answer
22 views

Get posts by name and taxonomy term

How do I get all posts that has a taxonomy term and a specific name/slug? I have tried with the following arguments but without getting the wanted result. What am I missing, how can I combine the ...
0
votes
1answer
9 views

Get posts associated with media attachment

Is there a good way to find all posts that contain a specific image? I'm working on the attachment single template, and I'd like to list the posts that contain that image.
0
votes
0answers
15 views

query order by a function

I was wondering how to order posts by a function that returns a number. I've set up a query and i want to order my post by that number. Here is what I have: $foo = get_like_count(); and in the ...
0
votes
1answer
18 views

Post with certain term and without any term

I try to create a plugin to manage user groups with permission to view posts within group and I stopped because of query problem. Example: User belong to group called "Group #1" (slug: group-1). I ...
0
votes
0answers
23 views

Custom Tax Query with special characters

I have this query that pulls posts form multiple custom taxonomies. IT works 98% of the time, the only time I have problems is when the term name has an apostraphe or special character, is there ...
0
votes
1answer
17 views

Sort by meta key within same day

I try to build something that can sort posts by day - and whithin the same day sort them with any meta value (integer) - like popularity or vote or what have you. So that, in the end, i get today's ...
0
votes
0answers
13 views

Query Search Not Working for Users

When I search for a User by their first name, all of their posts show up in the dashboard. When I search for that same User and add their last name, it does not show up at all. Not sure why this is ...
0
votes
1answer
30 views

WooCommerce - Query for ordered products

I'm trying to obtain all orders for particular day/time and then order products using SQL (MySQL) as seen in the query below: select p.ID as order_id, p.post_date, i.order_item_name, ...
-2
votes
1answer
17 views

Where can I find the SQL to get the most used information by wordpress database?

I tried to google "wordpress sql to get post url" and I was pretty astonished I couldn't find any resource sharing the SQL code to join the wp_post table with the table containing the permalink. How ...
0
votes
1answer
17 views

List of authors posts minus very latest

I'm creating an authors.php page to display all the posts for the author clicked. But the list(s) needs to show the very first / latest post so I can style it diferently than the rest of the posts? ...
0
votes
1answer
37 views

wpdb get_results() returns only 2 rows

I am trying to create custom admin widget to present how many users has registered within last days. I have created function as below: function mdbootstrap_add_dashboard_recent_users(){ global ...
0
votes
1answer
52 views

cron job to auto delete posts of a specific post type older than x days

I want to delete all posts of a specific post type (in this case "vfb_entry") that are older than 60 days. The cron job should run once a day. I have the following code but it's not working if I ...
-2
votes
1answer
20 views

Show post like this image in my newssite [closed]

I want to know how to query like this photo in my newssite for a category. See this image and help by give the query code. Do I use Offset or if else. How to query for this .
0
votes
1answer
27 views

Custom Query - Based on user input

I'm working on displaying suggestions to an input, assisting the user. I'm using the included jQuery suggest. That's loading - and through ajax I'm using a custom SQL query and can see it's ...
0
votes
0answers
17 views

Query Database for URL

I have a multisite setup and was wondering how I can query a database to find and retrieve a URL if it exists, otherwise, don't output anything... For example, using the two following domains which ...
0
votes
1answer
30 views

wp_posts query slowing down my website

My website's been incredibly slow and I installed the query monitor plugin to learn more about the issues that caused this. When loading my index page, the following query takes 0,2412 (seconds?!) to ...
1
vote
0answers
20 views

Query to get number of posts last week

I want to receive each monday the number of posts that were posted on my site during the week. The first part of the code retrieves the number of posts, and the second part sends me an email with the ...
0
votes
0answers
6 views

Add current user filter on WordPress's default celendar

I want the WordPress default calendar to only show the posts from the current logged-in user. Not the entire posts of the site. I had to hack the general-template.php to do that but really need to ...
0
votes
1answer
28 views

Display year value before a set of posts

This is what I am trying to accomplish: I have a page template which displays "case studies" where "case studies" is a custom post type. the page template called: page-case-studies.php I actually ...
0
votes
1answer
26 views

Querying users by meta value and getting a strange answer

Here is my case: I am trying to get all users with some value related to a specific meta key. In other words, I don't want to select users that have nothing on that meta key (mps_finalDate). So here ...
0
votes
0answers
36 views

Restrict access to custom post type and filter from every query

I created a custom post type topic which is just for internal use. I managed to assign the correct capabilities so that users of certain roles can edit/publish/delete posts. Now I want to redirect ...
0
votes
4answers
83 views

Insert widgets into loop/custom query at every nth position

The basic challenge: I have a 'normal' custom query, e.g. of news posts from a certain category and want to add in several elements (CTAs, generally speaking) at every nth position, while the loop of ...
0
votes
0answers
40 views

Show posts in numeric price order using meta query combining 2 meta keys

I've built a custom estate agency website for a client but I'm stuck on this one last thing before it's good to launch. I'm using custom meta fields to allow for additional meta data such as Price, ...
0
votes
0answers
27 views

wp query custom orderby not custom field

I am working on a products archive page where I show 20 products on each page with pagination. Each product's price is calculated by a formule which gets his parameters by data saved in the database. ...
2
votes
1answer
35 views

Modifying loop on a custom page, strange behaviour

I want to setup a custom page on my site that pulls in posts from only one category. I've taken my main blog page template, duplicated the file and assigned it as a template to my new page. I've then ...
0
votes
0answers
47 views

Function inside shortcode doesn't display WP_Query properly - custom post type

I have a problem with some shortcode and a function to display list of shops based on another shortcode. I wrote some code: Shortcode function shops_list($atts){ extract(shortcode_atts(array( ...
0
votes
0answers
22 views

How set offset on query with specific post_type from functions.php

I have a page template called 'page-blog.php'. On that page I have 2 queries that both obtain the posts of a different post type like so: $posts = ...
0
votes
1answer
24 views

Get previous posts list

I'll give up. Have searched and searched and tried and tried... Can't find any solution to list previous posts. On a single post: I want to show a list of the 10 previous posts, the 10 before the ...
0
votes
0answers
17 views

Displaying Taxonomy titles with their post

Suppose i have a taxonomy note_navigation like this Class 11 --Science --> THis is children of Class 11 ----Physics --> Children of Science and grandchildren of Class 11 ------ QUantum Physics ...
1
vote
2answers
83 views

Query string parameters from custom fields, inconsistent results

I've got a custom post type called course. Within a course post, I have a number of custom fields, specifically (all AFC select dropdowns): course_or_project, time_to_complete_project, ...