All Questions
Tagged with query customization
98 questions
0
votes
0
answers
37
views
Advanced Custom Fields in WP_Query: Href Returning Empty
I'm still learning the ropes of PHP so please bear with me!
So basically I have an ACF URL field "author_link" that I want to generate on a "table of contents" page in a list ...
0
votes
0
answers
92
views
$wp_query->found_posts; returns zero
I'm merging 2 queries using the code below and it works as I expected except for the $main_query->found_posts; returning 0.
$args = array(
'post_type' => 'carellcars',
...
0
votes
0
answers
194
views
Rewrite URL custom search query
I have this url:
mydomain.com/?s="SEARCH TERM"&categoria="WORDPRESS CATEGORY OF POSTS"&province="CUSTOM POST FIELD"&poblacion="CUSTOM POST FIELD"
...
0
votes
2
answers
133
views
User Query Multiple Orderby Clause
I'm having trouble getting consistent results from a WP_User_Query when ordering by multiple meta values.
There is a meta field that contains a serialized list of IDs, and I need to display users with ...
0
votes
0
answers
22
views
Can I log the searches that are returning 404 in the DB?
I would like to log every single search query for which one gets 404. For example, if I search Cat in the search box, but my website doesn't have any content as cats. I would like to log that "...
0
votes
1
answer
327
views
WP Search Form Query: Add Author's posts into search query
As the title suggests, I'm looking for WordPress advice relative to leveraging the standard searchform.php functionality to additionally query the author field when performing searches. I've tried ...
0
votes
1
answer
1k
views
How can I check that the acf field value is not a duplicate when adding a post?
I have a field in which I add the name of the record in the original language. And I translate the title into another language. When adding a new record, I need to check this field for duplication in ...
1
vote
0
answers
83
views
Hi, I wanted to make custom search with multiple fields
I wanted to make custom search with multiple fields in which we have to filter by post title and with other custom fields and taxonomies.
have a look on my code
Form
<form role="search" ...
0
votes
1
answer
633
views
display text generated via custom get query string
I'm trying to display some text on my page, generating it via get query string, e.g. calling this url:
mysite.com/page/?letter=exampletext
If I understand correctly in such cases it is needed to "...
1
vote
0
answers
59
views
How do I move/order posts with a tag to the end?
Let's talk about the situation first.
I have a query for finalists, some of which has a tag 'Special Mention'.
I need to move all posts with the tag to the end of loop.
e.g. I have 13 posts, 3 of ...
2
votes
0
answers
375
views
Meta query for custom post type ignored in main query
I looked through the interwebz but couldn't find a solution.
I am creating a website with custom post types where posts also include custom post meta (through ACF).
I am creating an archive file and ...
1
vote
4
answers
2k
views
Show Two custom Post type and their posts on category page
I have Two Custom Post Types "Article " & "News" and they both use same categories
like [ audit , income , tax] . I want when i open audit category page then the post showsn like below:
the code ...
0
votes
1
answer
234
views
Custom query pagination with php parameter as arg problem
I have create a loop with a custom query. This query contains a php parameters that i m getting from url with GET method. The problem is that the pagination (even if it counts the posts correct at ...
0
votes
1
answer
270
views
Add to search posts query array with post IDS which will appear first
Is there a way to add array of post IDS to set posts to be on top of search results?
Something like adding a param top_post_ids inside the search hool:
$query->set( 'top_post_ids', [45, 78, 94 ] )...
0
votes
0
answers
27
views
How to automatically pull an information from a form field onto an other page?
I created a form where people fill certain informations (name, phone, email, etc.). I would like to "catch" some information (name only) from the said form, once it is submitted, and have it ...
0
votes
2
answers
2k
views
Custom Loop Query For Search Page
I want to add custom query args to search.php and i made this:
<?php get_header(); ?>
<section id="primary" class="content-area">
<main id="main" class="site-main">
...
0
votes
1
answer
38
views
Query for specific custom field
I'm working to build a food blog and I'd like to add the feature that permits to logged users to save in a specific area all favorite recipes. I created two specific post types (likes and recipes) and ...
0
votes
2
answers
288
views
Query Posts to display all posts with category "custom field value"
I'm trying to figure out how to query posts on a custom post type, using a custom field.
Goal:
On my "artists" single page, I want to display a list of news/album releases for that artist only. ...
1
vote
1
answer
390
views
Multiple choice in a custom taxonomy
I've add a custom taxonomy in my function.php. Here the code:
function create_autor_nonhierarchical_taxonomy() {
$labels = array(
'name' => _x( 'Autor', 'taxonomy general name' ),
...
0
votes
1
answer
3k
views
Get specific ACF key and value from all posts - no access to DB
I have a custom post type "product" and I want to retrieve and display on a page all the values for a ACF field "product_url". I don't have access to the db via PHP MyAdmin, so I'm trying to query the ...
1
vote
2
answers
948
views
How I display post of the post type group by year of post?
I want to get all posts from my custom post type in groups by posts of each year.
2017 (5)
2016 (9)
2015 (7)
2014 (19)
2013 (3)
1
vote
0
answers
768
views
$wpdb->replace: WHERE?
My plan is to upsert values in a custom meta table with $wpdb->replace.
This is what I try:
$up_meta = $wpdb->replace(
'spieldaten',
array(
'spiel_uid' => $uid,
'...
1
vote
2
answers
4k
views
How to start with post number x?
I have two areas where I fetch the most recent entries. In the first area, I want to get the first 10 posts. In the second area, I want to fetch the posts starting at post number 11....
I have this:
...
1
vote
2
answers
684
views
Save title as custom field on custom post type
I need to have a hidden custom field that will be automatically populated with the title of the post on save.
My goal is to query posts by all its meta fields, including the title, but from my ...
-2
votes
1
answer
187
views
Include plugin´s table in custom query
I rephrased the question, following the suggestions of the contributors (below) helping on it.
As we know, WordPress search by default only incudes in this search function de wp_posts database table.
...
1
vote
0
answers
141
views
wp_query get post custom taxonomy in search.php
domain.com/?cat=id custom taxonomy not get post but category get to post
How do you write wp_query get post taxonomy?
<?php
$args_my_query = array(
'post_type' => 'post',
'...
0
votes
2
answers
509
views
get_delete_post_link() inside Loop stubbornly returns nothing
I've built a membership site where users can post listings from the frontend, edit those, and ideally also delete them.
For the latter, I'd like to echo a "delete post" link to the frontend. The ...
1
vote
1
answer
113
views
Function to delete a post, it's children and it's grand children (half way there already)
I've got a function working to delete a post and it's children. How can I amend this to delete it's grand children too?
<?php
function delete_post($sectionid)
{
global $post;
$...
4
votes
1
answer
2k
views
Order post by year DESC and month ASC
I have a worpresss 4.0.12 website; i created a custom template category-$id.php in which I have to show post ordering them by Year DESC and by month ASC (or a custom field ASC), the result should be ...
1
vote
1
answer
725
views
Create subpage /user/ or /my-profile/ like /author/ with additional query like /user/user123
I am creating some project and because of task, I need this:
domain.com/user/user123 - return profile of "user123" with his personal info
domain.com/my-profile - return profile of current logged ...
1
vote
2
answers
529
views
Wordpress custom Query for Posts in Category display posts multiple times
i'm facing a problem with my custom query and need your help.
I want to display all posts of a specific category and I find this snippet:
// get all the categories from the database
$cats = ...
0
votes
0
answers
257
views
Fastest and most efficient SQL query to check if UID exists
What's the fastest and most efficient way to check that a unique identifier exists in a database? Especially for an insanely large DB were you just want a true/false response to break when found.
...
0
votes
2
answers
439
views
Display posts by combining multiple meta key
Basically a post is an event therefor will be displayed once or twice, depending on meta key.
Every post has at least two meta keys $start_time_1 and $end_time_1. Let's say i have two posts, title: "...
0
votes
1
answer
47
views
Query 1 custom post type, each day, alphabetically
Hoping someone can help - for some reason my brain is mush on this one and I can't seem to find a similar example via Googling.
What I have is a CPT called "products" for example and what I need to ...
0
votes
1
answer
1k
views
Check if CTP category taxonomy is set in shortcode
I have created a custom post type with the ability to add categories (taxonomy).
Taxonomy
function create_cat_tax() {
register_taxonomy(
'cpt_cats',
'cpt_faqs',
array(...
0
votes
1
answer
67
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
1
answer
368
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
1
answer
48
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
1
answer
43
views
how to replace old DW site with new WP site? [closed]
I'm new to Wordpress.org. I have an old Dreamweaver website that I want to replace with my new Wordpress.org site, using my same original URL. How do I do this? I need simple, easy-to-understand ...
0
votes
1
answer
602
views
Custom Select Query pagination not working properly
I have Custom Select Query joining two tables and displaying events older than current date. Everything works fine until I try to paginate it.
<?php
global $wpdb;
$date = date("Y-m-d");...
0
votes
1
answer
4k
views
Custom select query two tables by a meta key
I'm using an event plugin which creates wp_ftcalendar_events table in database with start_datetime column. Here's image of whole table:
I want to query my posts by start_datetime. I know that I can't ...
1
vote
2
answers
32k
views
Deleting data from a custom table in WordPress
I am trying to delete records from my custom table but it does not delete anything.
Here is my code:
<?php
global $wpdb;
$retrieve_data = $wpdb->get_results( "SELECT * FROM wp_paypal" );
// ...
1
vote
0
answers
2k
views
Include data from custom table in WP_Query
I'm building an Estate Agent website. They have a system where they add their available properties and sends them all to the main property portals.
As part of this, the system also sends all the ...
1
vote
0
answers
1k
views
Using $wpdb (WPDB class) 'replace' with multiple WHERE criteria problem
I have two fields that are used to identify a particular row (acting as a composite key). If it does not exist, I wish to insert a new row.
The REPLACE function (http://codex.wordpress.org/...
0
votes
0
answers
42
views
How do I get a nested query to only display content that the main query outputed
I have a CPT 'artists' and a CPT 'events' I want the 'artists' to query first based off the posts tag and then I want the 'events' to query events based off what 'artists' was queried.
Heres what I ...
2
votes
1
answer
24k
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
2
answers
2k
views
Why in this archive page that call query_posts() function show only the last 10 posts?
I am pretty new in WordPress theme development and I am finding 2 problem with this posts archive page: http://lnx.asper-eritrea.com/archivio/
The previous page have to show ALL the blog posts into ...
0
votes
1
answer
518
views
List of Events with Multiple Dates: Only NEXT Date
I have Advanced Custom Fields 4.3.7 by Elliot Condon and Custom Post Type UI version: 0.8.2 by WebDevStudios.com "plugged" in and would like to limit pluggins to only those two.
I have multiple ACF's ...
0
votes
0
answers
2k
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 ...
6
votes
2
answers
36k
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).
...