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

learn more… | top users | synonyms

0
votes
0answers
91 views

Get thumbnail using wpdb from external wordpress database

I'm trying to get thumbnails from posts using a wpdb query where the wordpress database I'm querying is not the one from which the wpdb query is being called. That may be a little unclear, so here is ...
0
votes
1answer
37 views

Querying Posts by Taxonomy From Alternate Network Site

I have 5 Network sites in my WordPress multisite setup. One of which is the "primary website", which the rest of the other network sites will be retrieving data from. I am currently using ...
0
votes
2answers
67 views

get_post_meta with WP_query

I know this is a convoluted loop (inherited from someone else), and this must be pretty simple: the_permalink and the_title display OK, but why doesn't my post meta eventdatestart echo?. <?php ...
0
votes
2answers
67 views

Echo array value

I have following query to store data for last week entries in database: for ( $i; $i <= 7; $i++ ) { $val[$i]= $wpdb->get_results( "SELECT COUNT(`order_total`) AS 'Total' FROM vm_orders ...
0
votes
1answer
241 views

Filter post query to only show direct children of category

Google seems all purple on this subject, if you know what I mean. I've searched for this topic forever to find a solution. I want to build a finder/explorer feel to my categories, so when browsing to ...
1
vote
1answer
67 views

I am trying to hide a custom post type category to logged in users with Pre_Get_Posts

I have a custom post type in my theme called portfolio. It's categories are called project-categories. I am trying to exclude a project category for logged in users. I cannot get this to work at all. ...
0
votes
0answers
227 views

Check if values exists DB

I am getting nutts with this one. I want to check if the email introduced in the form already exists in the database before creating a new record. But for some reason the email is empty at search ...
0
votes
2answers
41 views

Trying to exclude posts from a category on the home page

I've tried the code below to grab the cat ID for one of my categories (watch-isatv) and exclude all of the posts in that category. However, the posts are not being excluded. What is wrong with the ...
0
votes
1answer
47 views

Sort loop with query in the link

I want to add some buttons that will sort the post by name asc/desc etc. I want to use query in the link like this http://domain.tld/?orderby=name&order=asc Is this safe to use? Are there ...
1
vote
1answer
47 views

Displaying Posts from Custom Post Types

I'm trying to display posts from regular and custom post types : <ul class="scroll"> <?php // the query $the_query = new WP_Query( 'cat=-4,-142,-143,-144' ); ?> <?php ...
0
votes
1answer
100 views

How Do I Delete WordPress Posts Older Than 400 Days, From A WordPress Category

I have tried the following phpMyAdmin query in an effort to delete all posts, from wordpress category 378, that are over 400 days old. delete a,b,c,d FROM wp_posts a LEFT JOIN wp_term_relationships b ...
0
votes
0answers
39 views

Problems With Query and/or Template Part and/or PHP

I'm trying to show only the last article. I made content-latestnews.php and it worked before meddling with queries. Template part was shown, but after I tryed to show the actual content it would show ...
0
votes
0answers
112 views

Pagination in custom loop for custom post type throwing 404 error

I searched around for similar problems but it did not worked for me, im a total beginner with WordPress. I made a custom query but the pagination throwing me 404 error Query $paged = ...
-1
votes
1answer
83 views

How to add multiple values with add_query_arg?

Let's suppose I am on this url of my site http://demo.com/?cat=1+2+3 And now someone clicks on a link generated with add_query_arg(). How can I make this link go to http://demo.com/?cat=1+2+3+4 Im ...
0
votes
1answer
55 views

How to set back query var author_name after unset it?

I am unsetting the query var author_name for querying posts in the author template page. I am using pre_get_posts to filter the main query. After the query is run, I need to set back the author_name ...
0
votes
1answer
90 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 ...
1
vote
1answer
31 views

Get IDs of posts currently visible on archive

This probably is a easy one for many. And also probably is already answered here, but I don't know how to search for it - so sorry I did search but not found anything. I like to get the contents of ...
1
vote
0answers
49 views

Delete duplicate rows from wordpress database where a column is duplicate in phpmyadmin

I have a wordpress table like so (phpmyadmin and MySQL) | id | meta_key | meta_value | +----+-----------+------------+ | 1 | import_id | abc | | 2 | import_id | abc | | 3 | ...
0
votes
2answers
207 views

How to query categories with Advanced Custom Fields?

I'm currently using Advanced Custom Fields and I was wondering if anyone know how to filter categories by custom fields? I have a custom field in my categories using the checkboxes field. I want to ...
1
vote
0answers
252 views

Query by 2 values of a repeater ACF field

Let's say I have a custom post type called Film, with a repeater field called Showings, with fields start_datetime and discount. I need to make a query for those Films that have at least one showing ...
2
votes
1answer
164 views

Custom Post Type order by modified date and custom meta field issue

I'm creating a plugin with some kind of offers that users can publish. User, in his custom administration panel, can managed his own offers. Offers are free and premium. If offer is premium it take ...
1
vote
1answer
48 views

How to display posts by vote count and if no value continue with latest posts with no votes?

Maybe someone can help me with this. I want to display posts by votes. Users can only vote up. So what I want is - the most voted posts by vote count on top and then latest posts with no votes. The ...
1
vote
1answer
747 views

Custom Search Query

I'd like to set up a custom search page that does the following: User checks off several items in a form that he'd like to see returned in his search (essentially choosing from a list of tags). ...
1
vote
2answers
53 views

Different Ways to Query Custom Post Types?

I'm using this code to use custom post types like regular post: add_action( 'pre_get_posts', 'add_my_post_types_to_query' ); function add_my_post_types_to_query( $query ) { if ( is_home() && ...
1
vote
2answers
40 views

Query custom post type only if it contains another custom post type

I currently have a custom post type named "blog". On registration, every user gets automatically a post "blog" linked with their user ID. This custom post type queries another post type named ...
1
vote
1answer
66 views

Custom query AFTER rss fetch_feed not working

I'm trying to do a custom query after an rss fetch_feed but for some reason nothing shows up. The code I'm using to fetch the feed is: <?php // Get RSS Feed(s) include_once( ABSPATH . WPINC ...
0
votes
1answer
47 views

Order terms by count - missing terms

I have this problem: I'm using get_terms with ordering by count. And some terms are missing - I have no idea why, there is no exlude, or hide posts or anything like this. What is wrong? Here is the ...
0
votes
0answers
64 views

There is way to improve this query? wordpress get post data and some meta data

Suppose we have 2 blog with different database A and B. I want to get some post from Blog B to show them on Blog A. The problem comes when the posts have much metadata (custom field for example) that ...
0
votes
1answer
169 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
0answers
33 views

Echo post content from archive page

I am trying to pull the latest post content in a archive page into the meta description, this is what I got: <?php } elseif (is_tax()) { ?> <meta name="description" content="<?php ...
1
vote
1answer
51 views

Query posts by content lenght

I am using the code below to pull a random post of my site every 6 hour. if ( false === ( $social_trans_post_id = get_transient( '$social_trans_post_id' ) ) ) { $args = ...
1
vote
1answer
118 views

Pagination with $_POST and $_SESSION

I have a page on my site where in the left column is a set of checkboxes representing taxonomies and in the right column is a list of posts that fall into the selected taxonomies. The user is able to ...
0
votes
0answers
50 views

Multiple Taxonomies Using Custom SQL Query

I am running a custom SQL query, and I am trying to pull posts with two taxonomies assigned to it. Here is my query which works: $querystr3 = "SELECT *, events_startdate.meta_value AS ...
0
votes
0answers
23 views

Using taxonomies to filter content

I have a wordpress install with ALOT of pages. These all have specific terms, from a custom taxonomy attached to them. Is it possible to have a <form> send a query with multiple terms ...
0
votes
0answers
47 views

Run query once inside a loop

I am trying to prevent to much queries inside a plugin one of my plugins. I have a query inside a function which will output a complete block with some layout elements and an input element which will ...
1
vote
0answers
241 views

How to get latest posts from each category in regular order

let's say I have a main query and it displays posts from Movies and Music categories. I want the query to show always 5 latest posts from Movies and 5 latest posts from Music category. When I create a ...
1
vote
1answer
107 views

Change media attachment author via mysql query

How does one bulk change the media attachment author via an sql query? I have hundreds of media attachments that need to be moved to another author so the original author can be deleted; but that ...
2
votes
2answers
194 views

Automatically adding meta data to posts or multiple query help

I run an events company whose website uses a custom post type system for posts (blog), events and tickets all stored as CPT's in the DB. On the guestlist (which counts 'ticket' custom posts if the ...
0
votes
2answers
87 views

Query to view scheduled or draft post

I have created a mailer template for my my single post. I can view the mailer version of my post using a url variable ?mailer I've configured the above using the code below within my single.php... ...
0
votes
1answer
31 views

Declaring a var, placing it in a query and using the output of the query?

So i'm wondering if it's possible to declare a variable that you'd place in a query to then use it in a update_post_meta function? This is how I tried to do it. First off I made a connection to ...
0
votes
0answers
50 views

wordpress page filter problems

Hello I been working on post type filter so I can filter my content for taxonomies type but for what ever reason I can never get it to filter when I click filter public function product_filters( ...
1
vote
1answer
45 views

Rewrite Rules returning wrong data

I have a custom post type called product. It is categorized with the two taxonomies product_category (which is superior) and product_group. I want the permalinks for single products to appear like: ...
0
votes
0answers
54 views

Best way to execute custom page-specific mysql queries

I would like to query a secondary mysql database (not the Wordpress mysql database) with page-specific queries. I've seen many answers / tutorials on setting up a secondary mysql database, like: ...
0
votes
2answers
474 views

Inserting data into `post meta` table?

How would I be able to insert data into the post meta table? I know how querying and wpdb works but I have no idea how I can just insert it into the table. I have these two fields I want to insert ID ...
0
votes
1answer
39 views

About WP's save_post action

Quick question, in API's some times save_post is used(most of the time actually). Is save_post the equivalent of the query action INSERT INTO whereas save_post saves metadata and forces Wordpress to ...
0
votes
1answer
183 views

Query posts from a specific category and selected tag

I am trying to have a page (tag page) with this conditions: query posts from a specific category (for example : products) show only the posts with a selected tag (the tag is variable) not all the ...
0
votes
1answer
69 views

How to SQL query posts IDs by categories AND authors?

I am making a custom WP_Query and I need to come up with a SQL query that gets the posts IDs from X categories and Y authors. Then merge those IDs and put them in an array. I only need to figure out ...
0
votes
2answers
75 views

Wordpress and a secondary database?

I have to achieve something on which I don't know how to approach it. Base of the issue: There's a bunch of data in another DB that I have to import into WP which so far wasn't possible due to them ...
0
votes
1answer
38 views

Custom types, taxonomies and query optimization

I'm doing a re-design and re-coding of a fairly large Wordpress website. As part of it we're adding some different post types representing various data types (website will have additional data-driven ...
0
votes
2answers
32 views

Include both default and Custom Post Type in query modified inside pre_get_posts

I want to include custom post type in the author arhive page. I tried the method discussed in this post: Including post_type = 'wiki' in author archives add_action( 'pre_get_posts', ...