Questions tagged [query]

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

572 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
0 votes
0 answers
31 views

old content are still displaying after using wp reset and clear cache

i have only two files in public_html folder, but when i opened the website link in private window, site old content is still displaying ? what i need to do to remove old site content ? index.php : ...
firstchoice entertainments's user avatar
0 votes
0 answers
9 views

How to query by subcategory and, if there are fewer than 10 posts in that subcategory, fill out with posts from parent category

I want to query all posts by subcategory and, if there are less than 10 posts in that subcategory, I want to return posts from the parent. If there are still not 10 posts, I want to fill out the ...
user18102663's user avatar
0 votes
0 answers
23 views

Optimizing AJAX Query with Large Database

I have a WordPress AJAX function that performs a location-based search on a website with a large database of over 100,000 posts... The function is responsible for querying the database to find the ...
Francisco's user avatar
0 votes
0 answers
94 views

Getting the correct post ID in Wordpress query loop

I'm trying to add custom field values inside a Wordpress query loop, so that I can have a list of titles, excerpts, and extras like start ratings in the loop results. I want to use something like echo ...
Marko's user avatar
  • 1
0 votes
0 answers
15 views

Add a category to posts, that DO NOT contain two specific keywords?

i'm a little bit underwhelmed. I use mostly plugins for everything but i think there is none that does that job. I'm looking to add a category (ID 18663) to posts that do not contain two specific ...
gooloode's user avatar
0 votes
0 answers
23 views

import/view table from external site

Good morning I state that I am a novice user and I would kindly look for someone to help me solve the following problem: I would like to know if it was possible to view directly on a page c/o menu of ...
Gianni Fazio's user avatar
0 votes
0 answers
205 views

Sort posts by category and date using php and custom query

I am using Elementor Pro and Advanced Queries and also ACF for custom date. I have 2 types of posts that are events - event 1 and event 2. I have an event calendar on the first page showcasing the ...
Tryandcry's user avatar
0 votes
0 answers
16 views

Why does my search query loop double on the second element?

I'm writing a custom query for a wordpress loop that should match and filter elements into three categories 'premium', 'nachhaltig', 'guenstig'. I do that with a counting variable: $search_count. At ...
Lisa's user avatar
  • 13
0 votes
1 answer
32 views

Optimizing or rewriting core queries

I am new to customizing WordPress and plugins core functions so I have a questions. Query monitor says I have a duplicate query that is executed like 13-14 times. The query in question is: SELECT ...
milenmk's user avatar
  • 113
0 votes
0 answers
29 views

How to modify the main query to show ACF fields

I have this code but the main query is preventing all ACF fields being displayed on the front end... // Add a new admin menu item for the options page function my_plugin_add_admin_menu() { ...
Pete's user avatar
  • 998
0 votes
0 answers
31 views

How to get posts that have certain meta key value and order based on another meta key's value

Here is the code I gathered off the internet so far: $args = array( 'post_status' => 'publish', 'posts_per_page' => '5000', 'post_type' => 'post', 'meta_query' => array( ...
Petar Vasilev's user avatar
0 votes
0 answers
50 views

Exclude a category ID from the following function

I've used a query that will query if the post in a specific category, to show a list of subcategories it belongs to. The problem I'm having is I also want to exclude a specific subcategory from the ...
Emma's user avatar
  • 11
0 votes
0 answers
20 views

Custom Filtering date with newsletter

Can anyone help me understand what the real problem with my codes i am trying to filter user with date range and newsletter. i already retrieved that using this function $newsletter = get_user_meta($...
shinzo vender's user avatar
0 votes
0 answers
48 views

Advanced Search - Is this possible?

I am currently working on a Wordpress website that needs an advanced search adding to it. I have three categories set up, each with a set amount of sub-categories, and then I'd like for a user to be ...
Emma's user avatar
  • 11
0 votes
0 answers
20 views

Meta Query compare with LIKE pulls similar post types: 55 and 155, and 1,155

In my admin I have a CPT called Artists, and another one named Exhibits. I connect exhibits to artists via a relationship field in the exhibition cpt. I setup a query on the artist page to pull the ...
TechyDude's user avatar
  • 125
0 votes
1 answer
154 views

Change permalinks in posts via SQL

I have changed our permalink structure for a better SEO Score. Our old was day and name like https://domain.tld/%year%/%month%/%day%/%postname%. On our site are around 2600 posts with links to other ...
Stefan's user avatar
  • 1
0 votes
0 answers
166 views

Use value from meta key array for use in WP_Query

I have a CPT named 'Physicians', and have assigned an ACF field named locations to that post type — locations is an ACF post object field. I also have a 'Locations' CPT and intend on displaying the ...
Graeme Bryson's user avatar
0 votes
1 answer
246 views

Query Loop Block: possible to restrict just child pages?

Is it possible to use the Gutenberg Query Loop block to restrict the output to just the page's children pages? Or is it necessary to alter the theme?
Marc P's user avatar
  • 513
0 votes
0 answers
20 views

I am using the query block and what I want and see on the editor page is not the same with the actual results

I want my posts to be just as the first picture on a grid formation but when I save and view the page it shows otherwise.
Csopso's user avatar
  • 1
0 votes
0 answers
96 views

Use Base-URL with Query-Loop

I've set the Base-URL for my WordPress page with <base href="https://www.example.com/" /> function custom_header_metadata() { ?> <base href="<?php echo ...
Marzii's user avatar
  • 23
0 votes
0 answers
688 views

Querying Posts from ACF Repeater Subfield Select Value

I am attempting to query posts based on the value of a repeater subfield dropdown (select field) but am having trouble. Here is what I am working with: <?php // Set up the arguments for the ...
moorewebx's user avatar
0 votes
1 answer
39 views

Use meta query only 3 or more results?

Using elementor I'm currently running the following: add_action( 'elementor/query/model-query', function( $query ) { $meta_query = $query->get( 'meta_query' ); $meta_query = array(); ...
BN83's user avatar
  • 101
0 votes
0 answers
56 views

Search query alteration not working for meta values

The bellow code works on category archive pages, it filters out the necessary products. But on the search page it doesn't work. If I uncomment the line //$query->set("s", "chelsea&...
JorensM's user avatar
  • 101
0 votes
0 answers
21 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 "...
Rajin Sharwar's user avatar
0 votes
1 answer
222 views

Modify a query using both a text field and a true/false AFC field

I am using the following code to modify the CPT "movimiento" query. add_action( 'pre_get_posts', 'mov_vec_archive_page' ); function mov_vec_archive_page( $query ) { if ( !is_admin() &...
xaifu's user avatar
  • 31
0 votes
0 answers
30 views

Can Wordpress support Website (19GB database) Should I move Our Wordpress Website to a custom one using Laravel or any other PHP framework?

QUESTION: Should we migrate our website to a custom build? PROBLEM: We run a WordPress website that currently has 19GB of MySQL Database data aside from images. We are facing issues such as site speed,...
Rhema's user avatar
  • 1
0 votes
2 answers
180 views

Checking if the query is empty does not work

I hope you have a good day. I get a query from the database, If the query is empty, the message "Register" will be displayed Otherwise, the message "Register" will be displayed See ...
Fardad Farhang's user avatar
0 votes
0 answers
167 views

How do I troubleshoot Maximum execution time of 60 seconds exceeded in updating a Media File?

I'm on a shared hosting plan. Getting this error log entry when the user tries to update any field on a Media Attachment. [13-Oct-2022 20:10:05 UTC] PHP Fatal error: Maximum execution time of 60 ...
jchwebdev's user avatar
  • 765
0 votes
1 answer
753 views

Query filter on custom post by current author in post widget for elementor query id

I am using post widget in elementor pro. Idea is to show all posts by a specific custom post type. Now, I want to apply also some filters in particular I want to show only posts in a particular status ...
Ioria's user avatar
  • 29
0 votes
1 answer
224 views

update $wpdb one query

Is there a way to change mysql directly in wordpress just 1 operation without needing 2 operations: query and update? I am facing problem of multiple concurrent transactions impacting point_user I ...
Công Tử Huyết's user avatar
0 votes
0 answers
17 views

How can I modify this code to make the search box include tags and meta

How can I modify this code to make the search box include tags and meta I would like the search in same box if($_GET['s'] && !empty($_GET['s'])) { $text = $_GET['s']; } if($_GET['type'] &...
التقنية tech's user avatar
0 votes
0 answers
153 views

Show Posts via cat+cat in URL that are in both Categories doesn’t work

it seems like i am the only person on this planet currently experiencing this issue. When i search for www.gooloo.de/category/balea+vegan, it should only show posts, that are in BOTH categories, but ...
gooloode's user avatar
0 votes
0 answers
26 views

Return records between two meta datetimes saved as strings

I have a start date and an end date saved as post meta fields (so strings). I want to return posts between two date ranges. I thought it would be a simple string comparison - one datetime represented ...
CraigD's user avatar
  • 1
0 votes
1 answer
78 views

Exclude in get_pages() based on meta field

I'm using get_pages() in order to get all the posts from a custom post type hierarchically for creating a custom "next/previous" navigation. I use it like this: $sibling_list = get_pages(...
knox's user avatar
  • 101
0 votes
0 answers
25 views

Exclude taxonomy Query if post_type

How can I define in pre_get_posts hook on custom post type to not execute the query on a taxonomy. I have the following if (!empty($newsType) && $newsType == 'press') { //if $newsType ...
fefe's user avatar
  • 874
0 votes
0 answers
39 views

Query multiple post types, but different order for each

I have a query which searches 2 post types as below: $args = array( 'post_type' => ['post', 'promotion'], 'posts_per_page' => 12, 'paged' => $...
finlamit's user avatar
0 votes
0 answers
665 views

SQL query - get a featured image's alt / alternative text

I am writing some SQL queries to get post data out of a database for certain posts (so WP functions are not an option). I am trying to get post IDs, post URLs, post featured image URLs and associated ...
Anthony's user avatar
  • 31
0 votes
1 answer
25 views

get products by custom date variable

i have a product attribute called review_date, and i would like to order these products by that date. I haven't seen a working solution yet.. what am I doing wrong here? $args = array( '...
Sander1020's user avatar
0 votes
1 answer
22 views

Target a page with query

I have those 2 pages that are created from a plugin (see the plugin https://zombify.px-lab.com/frontend-page/, just login and choose a post type, check the url): https://www.domain.com/post-create-...
Honoluluman's user avatar
0 votes
0 answers
17 views

How do I set the Stewart Search Template to return only published posts in the result

I recently took a WP.com online webinar and the moderator referred me here to ask my question. I am trying to redesign my site using FSE. I am using the "Stewart" theme. I have added a ...
Kevin's user avatar
  • 1
0 votes
1 answer
200 views

Reject all malicious URL requests functions.php

this might not be the right place as it's a question about a function snippet that relates also to the server and log files. I have been trying to block access to my site from bad query attempts which ...
lee03's user avatar
  • 1
0 votes
1 answer
24 views

How to divide Subcategories into pages of parent category wordpress

suppose I have sturucture like this: Justin Bieber > Albums > Justice when I visit on https://example.com/category/justin-bieber/albums/ It is showing all albums of Justin Bieber category. but ...
John Brew's user avatar
0 votes
0 answers
56 views

Display posts ONLY from the current logged in user and current week/year/month Elementor posts

I want to show the posts my users have added in three different sections. That would be "Your Posts from This week" and so on. I am currently using: add_action( 'elementor/query/currentuser',...
guerillaradio's user avatar
0 votes
0 answers
84 views

Using One Function To Create Two Different Shortcodes

To populate a player rollcall, an extensive query pulls data from tables in my external MySQL database. Part of this also extracts the player(s) who a) made the most appearances and b) scored the most ...
Pete Hayman's user avatar
0 votes
0 answers
1k views

JetEngine Query Builder - order by value from repeater

Using Wordpress JetEngine UI. I have: a JetEngine Post Type named "Stores" it has a meta field nearby-cities (repeater) each nearby-cities entry has city-name and distance repeater fields I ...
Arman Bimatov's user avatar
0 votes
0 answers
65 views

Change pure SQL database query to WordPress post query?

I am trying to query posts that are nearby a given (lat/long) location. I have found this working SQL query, but this won't provide me flexibility to alter the queried later on, since I am not really ...
RobbTe's user avatar
  • 242
0 votes
0 answers
68 views

Merge CPT Taxonomy and Post Taxonomy in $query->set

I'm merging blog posts and a custom post type into a single query and displaying them on my feed as well, here's the code: function add_query_news_projects( $query ) { if ( is_home() && $...
douglaskarr's user avatar
0 votes
1 answer
126 views

Wordpress Query - Display 5 posts (same post type), each from a given tag

We have a news section on our website. We have basically 5 companies giving publications: ('ENEFI', 'dmker', 'megakran', 'otp', 'futuraqua') We would like to list the latest one from each and order ...
Pbalazs89's user avatar
  • 115
0 votes
0 answers
30 views

Update query based on CPT / Post Type, show all sorted by date

I'm trying to accomplish something similar and read through Vayu's code, which is super elegant, but it doesn't accomplish what I need. Specifically, I need to be able to include a different template ...
revive's user avatar
  • 225
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 ...
Алексей Сотников's user avatar

1 2 3
4
5
12