WPIntell

Source evidence

Issue Excluding Normal Posts from Custom Reordering

Post Types Order · support · 2025-03-17T15:10:00+00:00

mixedsentiment
mediumseverity
0.73relevance
1replies
Evidence linked to opportunitycommercial context

Proof Health

Open evidence

Commercial opportunities need traceable source links before they are treated as build-worthy.

5 / 16 rows with source links

31.2% of this page's analysis has direct source links.

0 build-decision rows missing links

0 rows here require auditable proof before promotion.

11 rows with no attached evidence

0 rows have source counts but still need direct links.

Conversation

support
sarkanyjudo resolved
Hey Team, I’m encountering an issue with excluding standard posts from custom re-ordering. Despite using the following code, the order of some normal posts on the frontend still appears incorrect: add_filter('pto/posts_orderby/ignore', 'theme_pto_posts_orderby', 10, 3); function theme_pto_posts_orderby($ignore, $orderBy, $query) { $post_type = isset($query->query_vars['post_type']) ? $query->query_vars['post_type'] : ''; if ( (is_string($post_type) && $post_type == 'post') || (is_array($post_type) && in_array('post', $post_type)) ) { $ignore = true; } return $ignore; } Could you help me identify what might be causing this issue? Any insights would be greatly appreciated. Thanks a lot! Judit Hi, I don’t see any issue in your code, the customised order should not change for the ‘post’ object type. The filter is also explained at https://www.nsp-code.com/ignore-sort-apply-for-certain-query-on-post-types-order/ Try moving the code to a custom file on your /wp-content/mu-plugins/ Also make sure the query is actually including the post type you looking for. You could just print_r the object to see all properties. Thanks

Comments

1 shown
Maya 2025-03-18T09:37:00+00:00

Hi, I don’t see any issue in your code, the customised order should not change for the ‘post’ object type. The filter is also explained at https://www.nsp-code.com/ignore-sort-apply-for-certain-query-on-post-types-order/ Try moving the code to a custom file on your /wp-content/mu-plugins/ Also make sure the query is actually including the post type you looking for. You could just print_r the object to see all properties. Thanks