errors - How to identify the origin of an issue or an unexpected behavior?

admin2025-04-17  1

When something doesn't work on a WordPress website (and when it's not a php error), what should be the protocol to properly identify the origin of an issue or an unexpected behavior ? How to proceed exactly : i mean, is there a very logical step by step process that i should follow ?

Here is the situation i'm facing, to illustrate my question : in a local environment, with the last version of WordPress, with Polylang ACF and ACF Post-2-Post plugins activated, I try to create a bidirectional relationship between two posts (one is a about an author, the other is about a book, and i use ACF Post-2-Post to display a link on each page in direction to the other), and it works perfectly when i use it on a standard template like Twenty Twenty or Twenty Seventeen : it displays a link on the book post targeting the author post, and it displays a link on the author post targeting the book post.

The issue I'm facing is : when i use my very and basic template everything is working except one part of the relationship : the link on the author post targeting the book post is still present, but not the one on the book post.

What should i check to be sure to identify the origin of my issue ?

EDIT : finally, i've found out the issue i'm facing was caused by a snippet of code I use in my functions.php in order to exclude from the homepage few posts belonging to some categories:

function exclude_category_home( $query ) {
  if ( $query->is_home ) {
    $query->set( 'cat', '-44, -46');
  }
  return $query;
}
add_filter( 'pre_get_posts', 'exclude_category_home' );

But I still dont understand why I have this issue and how to understand or analyze the problem.

转载请注明原文地址:http://conceptsofalgorithm.com/Algorithm/1744857403a270911.html

最新回复(0)