Questions tagged [join-tables]
The join-tables tag has no usage guidance.
30 questions
0
votes
1
answer
21
views
WPML posts_joins on translated items
I found a way to filter the search query so it goes though the product_cat title and description to look for a term and then display all the connected product.
I am now looking for a way to make it ...
1
vote
0
answers
244
views
WordPress post_where & posts_join not working only for custom post type
I have a custom WordPress plugin built for booking courses etc.
My custom plugin has some new tables in which custom data like slot date, time etc are stored.
I am trying to modify archive query for ...
0
votes
0
answers
63
views
Custom SQL query slows down when using multiple OR ... LIKE ... in posts_where filter
I have built a posts query that includes a custom table in search using the posts_join and posts_where filters.
Now the customer wants me to include yet another custom table in the search, but doing ...
0
votes
1
answer
354
views
can I extend the WP_Query class to deal with 'duplicate' posts created by joining to wp_posts?
Based on the premise that one big database requests is better than many smaller ones, I've modified WP_Query for my custom post type 'word' and joined three tables to it. The resulting query looks ...
0
votes
2
answers
191
views
order posts by a secondary query that counts items
i'm working on a music plugin.
It uses a custom table tracklist_items to store every tracks of a playlist; which has a structure like this :
|id| |track_id| |tracklist_id| |order| |time|
So if I ...
1
vote
2
answers
2k
views
How to display upcoming events by dat with Modern Events Calendar Lite
I'm using the plugin Modern Events Calendar Lite.
This is a recent plugin, so actually no doc exist.
So i'm looking a way to display my upcoming events on homepage. But i can not make it to work, ...
0
votes
1
answer
88
views
Build table using Advanced Custom Fields
I have a table that populates data pulled from ACF. It basically adds a PDF of a report if there's one available. I think I got that part figured out, but my code is awfully complicated and I'll like ...
1
vote
0
answers
85
views
What Is the Proper Way to Merge Usermeta Table to a an existing WP Database?
I'm currently testing some features on a sandbox environment. I have an existing production website and I'd like to ship my production users and other related tables on new sandbox environment. While ...
4
votes
1
answer
1k
views
Custom Queries: Joining On Meta Values From Two Custom Post Types
Hi – I'm hoping this is the right place to be asking this question.
I am in the process of moving my full football club website onto Wordpress, therefore using a single database for the information ...
-1
votes
1
answer
26
views
How do I insert the following into my custom table?
$service = array(
'show_option_all' => 'Select your Service',
'show_option_none' => '',
'option_none_value' => '-1',
'orderby' => 'name',
'order' => 'ASC',
...
0
votes
0
answers
179
views
Custom user query - orderby meta_key (that may not exist)
I'm in need of someone who knows MySQL better than I do! I've started writing a custom statement, but I'm not an expert with mySQL and it's not quite there (I'm happy to scrap it entirely if there's a ...
0
votes
2
answers
3k
views
What does the $posts_join filter join to?
I am trying to use the posts_join filter to join 2 tables: wp_postmeta to wp_posts. I am a novice at SQL, so I'm not sure if I am confused because I don't understand how WordPress is implementing ...
1
vote
1
answer
14k
views
writing inner join in wpdb
I have a problem in writing SQL Inner Join syntax in wordpress,
This logic should definitely work, I tried this in phpmyadmin and it works fine
SELECT booking_calendars.cal_name
FROM ...
2
votes
2
answers
3k
views
Query All users that has post
I have this query so far :
$user_args = array(
'role' => 'frontend_vendor',
'orderby' => 'display_name',
'order' => 'ASC',
...
0
votes
1
answer
2k
views
Inner Join user tables to select users with roles
I am trying to view a list of users (who are music artists) with the following function.
function show_authors($ltr) {
global $wpdb;
$querystr = "SELECT $wpdb->users.* FROM $wpdb->...
0
votes
0
answers
82
views
WP_Query to show post from a category OR custom field - Not 100% answered
Regarding answer provided by birgirethis to this post: wp-query-to-show-post-from-a-category-or-custom-field
I found one issue with your solution. The two inner joins (term_relationships and postmeta)...
1
vote
0
answers
141
views
Using $wpdb to fetch posts with meta data
I have a post type "shows" with 500 posts in it. I want to list all 400 in one page listing their title + 5 meta fields and a url to the show post thumbnail.
I initially went the classic wordpress ...
1
vote
1
answer
4k
views
How to use filter hook posts_join for querying taxonomy terms in posts_where?
For the last few hours, I have been trying to use the filter hooks posts_where and posts_join to search for posts based on taxonomy terms, in this case, the taxonomy is 'category' and the term is '...
2
votes
1
answer
6k
views
How to search for posts IN OR title OR content OR author?
I have looked at many posts and questions regarding searches for custom meta, but I want to search for posts and include those if the search query matches an author name.
I have come up with the ...
0
votes
1
answer
945
views
WP_Query hit max joins... How else can I build a search function that uses custom fields?
I'm trying to search a custom post type of "Properties", while doing so I'm also searching the custom fields using multiple (anywhere from 5-30) meta_queries. The problem is Wordpress or MySQL is ...
0
votes
1
answer
1k
views
Are term_taxonomy_id and term_id the same? [duplicate]
I have a custom query where I need a JOIN because I want to COUNT all the posts of a specific category.
So I checked the tables and I found out that table wp_term_relationships contains a reference ...
0
votes
1
answer
818
views
$wpdb - joining shows no result
For one of my client's WP site, I'm making a plugin, where I'm using the db Query. I've two custom tables dedicated to the plugin:
user_req — stores user chosen posts along with some custom fields' ...
0
votes
2
answers
4k
views
How to join tables?
I know many posts is on the site about this but I can't understand how it work.
This SQL works.
SELECT wp_category.id, wp_ogloszenia_kupione.kategoria, klient_id
FROM wp_category
JOIN ...
0
votes
1
answer
91
views
Reordering content using a meta value
I've got this theme where you can add posts of type "portfolio", and I want to be able to reorder them up. I've added a custom meta field called "position" and I've set already those values. All good. ...
0
votes
2
answers
5k
views
Wordpress SQL JOIN query
Hi
Im trying to run 2 querys in the same query call.
// send the query
global $wpdb;
$commentQ = "SELECT * FROM $wpdb->comments " . $whereClause . $orderBy;
$comments = $wpdb->...
1
vote
2
answers
2k
views
Join new table with SQL query
I created a plugin with a new table (wp_soundcloud) and I need to retrieve the data from that new table along with the post data.
Here is my query:
$querystr = "
SELECT $wpdb->posts.*,
...
0
votes
1
answer
1k
views
List author's posts with SQL
I want display authors'posts with the code below but authors' name aren't showing.
What is wrong?
<? // query test
$qry = $wpdb->get_results( $wpdb->prepare("
SELECT *
FROM $wpdb->posts
...
-1
votes
1
answer
123
views
Custom wordpress SQL statement for a website
I'm trying to link specific columns from a few standard tables in a wordpress database. I specifically want to see a view/table that includes:
post title
post content
guid
meta value = image url
...
0
votes
2
answers
332
views
Joining tables not working in the post editor page
I am developing a plug-in which stores data in a custom table and is joined onto the wp_posts by the post's the id. I then use the posts_join and post_fields filters to join my table and be able ...
1
vote
1
answer
13k
views
Join inside a wpdb query.. confused!
I need to get a return from a query that provides me with email, username or nicename as well as post title based on author id.
The query is to run once daily via cron and look for posts that have ...