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

learn more… | top users | synonyms

0
votes
0answers
10 views

Having trouble going from Jfiddle to implementing in Wordpress :(

If someone could point me in the right direction on how exactly to do this without yelling about follow codex site lol. I wouldnt be here if I wasnt able to get it working haha. I created a neat ...
0
votes
0answers
14 views

Alternative layout the loop

i'm trying to make an alternative loop as found here on stackexchange, it has been a great help to what i've achieved so far, but i'm stuck now. The goal is to make the newspage look like this The ...
0
votes
0answers
22 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
6 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
17 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
24 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
3answers
1k views

How to delete all posts, categories and tags from Wordpress database

I have WP website with over 40,000 posts. Now I'll like to delete all posts, categories and tags. So All content and related meta. All I want to keep is static files. Is there a easy way to do this ...
0
votes
0answers
11 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() ?>" ...
2
votes
2answers
2k views

Get category slug and display it on a query_post

I just read "How to create option page for wordpress theme" in wp.tutsplus.com - I have a problem with getting categories . there is two parts to my question - Part A - Get category slug and ...
1
vote
2answers
503 views

How to retrieve attachments from child pages of a specific Page?

How would I retrieve attachments from all subpages of a specific Page ID? Example: SPECIFIC PAGE Child (with attachments) Child (with attachments) Child (with attachments) I'm currently ...
0
votes
2answers
36 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
613 views

WP Query Sort by meta value (date)

I have the following code where I want to sort by meta key "event_date" and only display posts after todays date and 3 weeks ahead. Somehow nothing happens, even when I'm stripping down the WP Query ...
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
33 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
1answer
159 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
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 ...
12
votes
7answers
60k views

What SQL Query to do a simple find and replace

Whenever I create a new website I first create a staging site on a subdomain like "stage.domain-name.com". After everything works correctly I export the database, open it in notepad++ and do a ...
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 ...
0
votes
1answer
452 views

Delete query won't run

This is the set up: <form method="post" action=""> <input type="hidden" name="delete_app_id" id="delete_app_id" value='<?php echo $adoptee->app_id; ?>' /> ...
-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
521 views

How Do I Merge Categories With phpMyAdmin

I tried the following phpMyAdmin query to merge my category 112747 into my category 112748: UPDATE wp_term_relationships SET term_taxonomy_id = 112747 WHERE term_taxonomy_id = 112748; It did not ...
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
432 views

WP_User_Query with more than two custom meta values

I am trying to create a custom user query based on users' metadata. I have the following query created. $users = new WP_User_Query( array( 'search' => '*' . $search_name . '*', ...
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
747 views

Load more posts with multiple queries

I've been developing a theme which uses the load more ajax plugin, everything is setup and working great with the main query. But, once I setup a new query for popular posts, the load more posts ...
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.
258
votes
7answers
95k views

When should you use WP_Query vs query_posts() vs get_posts()?

It seems like half the tutorials in the Codex and around the blogosphere use query_posts() and half use WP_Query. What's the deal?
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
19 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
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, ...
0
votes
2answers
4k views

How do I create a meta box for dates?

I am creating a custom events page and I want to know how to create a custom meta box to save event dates. I don't want it to be a regular meta box because I will be using this to make a custom search ...
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
675 views

SQL to update custom post taxonomies

I have a custom post "review". It uses the same categories and tags from default posts, so they share "category" and "tag" taxonomies. But later I changed the "review" register to have their own ...
0
votes
1answer
18 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
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? ...
-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
2k 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
2answers
520 views

Get ID of child from child slug, while knowing parent ID

I have a hierarchy that I need to get data from. It's the child (by slug name) that I need to get while already having knowledge of the parents. Highest Known Parent Page (slug : 'parent') |_ Child 1 ...
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 ...
1
vote
2answers
3k views

Count user posts by user ID, Post type and Post status

What I am trying to do is modification of this function on codex http://codex.wordpress.org/Function_Reference/count_user_posts Check the title adding post type support bottom of the page. The ...
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 ...