2
votes
Accepted
How to obtain the recent posts without their content in an efficient way?
How to obtain the recent posts without their content?
The same way you would any other post, just don't use the post content.
Not fetching the post content will not improve performance, and may ...
2
votes
Accepted
Include current post into loop
I'm not sure why you'd want a post you're already looking at to be in the similar... but off topic I guess.
You ask it not to include the $current_id in this line here
if ( $score > 90 && ...
1
vote
Accepted
Get posts that do not have the same tags as current
I found an answer to my own question:
If I use the tax_query arg then I could specify 'operator' => 'NOT IN' like so:
$events = tribe_get_events([
'tax_query' => array(
array(
...
1
vote
Accepted
change the default order of posts only for specific categories
Problem 1
$foo = is_category( ... );
Is the same as:
global $wp_query; // the main query
$foo = $wp_query->is_category(....);
So when filtering the query, don't check the main query, check the ...
1
vote
How to make posts unqueryable/unpublish posts where ACF relationship field is an unpublished post?
You should probably check out pre_post_update.
Use pre_post_update to check for a post update within your custom post type Container of Things. Check for your conditions. Then, get the connected ...
1
vote
Conditional operator OR not working with custom fields
The problem is that you used OR, specifically the human verbal colloquial understanding, not the logical definition. What you actually meant was AND.
Here's a table demonstrating what happens to A and ...
1
vote
Accepted
complex get_posts() query to select child pages
You need a loop for this to handle the condition:
/** list for course and childless department pages */
$course_and_childless_department_pages = array();
/** get department pages */
$department_pages ...
1
vote
Accepted
Change the destination of the URLs in post.php
The post title and inline "Edit" links in the posts list table at wp-admin/edit.php uses get_edit_post_link() which applies a filter hook also named get_edit_post_link, so if (I correctly ...
1
vote
FacetWP paging custom wp_query
I know this is probably too late, but you need to wrap the post-loop part of the code with <div class="facetwp-template"></div>. The facet filters piece of the code should fall ...
1
vote
Rest Api How to get results of child categories with one api call
Just stumble on this because I was looking for the solution to same issue.
Don't know if it was changed but it no longer works (if ever was).
Now, you have to make call to categories endpoint /...
1
vote
get_query_var('paged') always returns empty
Try to use the following:
$paged = (get_query_var('page')) ? get_query_var('page') : 1;
Instead of using:
$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
I had the same issue and it ...
1
vote
How to Get All Posts with any post status?
Since I can't yet comment: $args['post_status']='any'; works for 'publish' and 'draft', but not for 'trash', I needed $args['post_status']=array('any','trash');
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
query-posts × 1237wp-query × 361
custom-post-types × 210
posts × 197
loop × 189
query × 111
categories × 100
custom-taxonomy × 85
get-posts × 82
custom-field × 81
pagination × 63
meta-query × 61
php × 56
post-meta × 52
customization × 44
functions × 40
order × 35
filters × 30
sort × 30
search × 25
plugin-development × 23
archives × 23
plugins × 22
array × 21
taxonomy × 20