Unanswered Questions
1,760 questions with no upvoted or accepted answers
2
votes
0
answers
2k
views
WP_Query & AJAX
When calling wp_query via AJAX and passing a category ID and search parameter, the query does not return any posts. On page load, the query runs fine, which runs the same query.
If I add these ...
2
votes
1
answer
116
views
how to get the id for a post from within a post and return post meta for it
I need to query for a post outside of another post: I am using a hook to import a page builder template and I need a query in relationship to the post it is hooked into. I not a huge fan of builders ...
2
votes
2
answers
5k
views
Two loops on archive page
I have 2 loops on the archive page. I want the first loop to display the 2 last posts of the category and the second loop offset 2 last post!
<div class="top-posts">
<?php
if (...
2
votes
5
answers
6k
views
How to order posts by title after they have already been sorted by category
I'm not an expert at much, so please excuse me if this is an easy question... but it's got my head spinning.
I have an archive template (adapted from a standard 'enfold' theme template) which I am ...
2
votes
0
answers
1k
views
Sticky Post default functionality with WP_Query is ignored when using AJAX
I am writing custom ajax pagination for a Blog archive page and I am running into an issue with sticky posts.
The default functionality of sticky posts when using a WP_Query call is to sort all ...
2
votes
0
answers
419
views
How do I dynamically generate args for wp_query?
I am trying to build up my search args depending on variables passed through from a form.
What I want to do is add to args if values are present.
For example if there are dates I have:
$args = ...
2
votes
0
answers
1k
views
wp_reset_postdata() and wp_reset_query() inside shortcode are not working to reset original page query
I'm implementing a form for a frontend post with a shortcode. The form is processed in the same function, reloading the page:
function adicionar_ninhada(){
$user_id = get_current_user_id();
if (isset(...
2
votes
1
answer
256
views
Lists Posts from CPT that match the Title of the Page
I am trying to get all the posts associated with the Title of a page.
This is what I currently have:
<?php
$title_to_tag_posts_query = new WP_Query( array(
'tag' => ...
2
votes
1
answer
2k
views
Wp query show post by author name or post title or post content
I have to create a search query which allows me to filter all posts where author name and post titles or post content has the word from search textbox.
So if i search wordpress it should list all the ...
2
votes
0
answers
135
views
WP_Query's "request" SQL Query
Lets say that I want to use a MongoDB for searching. I saw that WP_Query has a property named request which it seems that holds the SQL Query which is executed on the SQL database.
Now if I write a ...
2
votes
1
answer
367
views
Help with CPT template pagination
i created a themes CPT using the following code
function pp_themes_post_type() {
$args = array(
'public' => true,
'label' => 'ProfilePress Themes',
'...
2
votes
0
answers
1k
views
tax_query OR with empty result returns all posts
I'm running a WP_Query with a tax_query with two tax_query statements with an OR relationship.
$tax_query_terms = array(
array('taxonomy' => 'post_tag',
...
2
votes
1
answer
494
views
How to do a query on custom taxonomies that is uncategorised?
I have a custom taxonomy and I wish to do a query for all custom posts who has no value assigned for that taxonomy (i.e. uncategorised).
This is what I have so far:
$uncatQuery = new WP_Query( ...
2
votes
0
answers
1k
views
WP_Query Order by Specific Post ID First
I'm creating a website where I have a need to show a set of posts from a custom loop but I need to display a specific post first.
This post will be dynamically specified in the URI by a $_GET ...
2
votes
1
answer
176
views
WP-Admin edit.php & post.php slowdown after import of 10k users
Situation:
Clean wordpress install
No plugins
VPS server 5.2ghz / 4gb RAM (Default Directadmin)
Import of 10k users
Problem:
WP-Admin edit.php and post.php take >4sec to load.
A custom post type ...