The theme is called Colormag. I am using the free version. The 404 behaved correctly on a new WordPress locally hosted site which used Colormag. i.e. the issue that was triggering the issue with Connections did not occur.
I couldn’t find any places where $wp_content was being set to null.
I’ve just tested on them Twenty Fifteen and the issue still occurred. So it isn’t Colormag specific.
I’ve changed your code as follows in the function
filterPostTitle() in class.seo.php.
if ( ! is_object( $post ) || $wp_query->post->ID != $id || ! self::$filterPermalink ) return $title;
$post_id = get_queried_object_id(); if ( ! is_object( $post ) || $post_id != $id || ! self::$filterPermalink ) return $title;
I’m not saying this is a fix, as I’m a novice. I’m just wondering why this would work? It intuitively feels to me that this either:
- The callback is getting called when something isn’t a post and so
$wp_query->postis not set OR
- Something is unsetting or nulling
- The callback is being correctly called and $wp_query->post is a known unreliable way to access the current post object
These are all guesses… can you give me some clues as to what might be going on? I’m sure your code is sound… I just need to double check with you so that we are keeping this water tight… so I can ensure the ‘leak’ is elsewhere (please excuse my flaky metaphor).