You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Firstly thanks for a cracking plugin save me hours of coding. On my latest project I started getting the annoying Notice: Undefined property: WP_Query::$post. I always developed with debug to true and this bugged me for a while. In the end I tracked it down to the pre_get_posts call in WP_Router_Page.class.php around line 111. I implemented a simple check to solve my issue
public function edit_query( WP_Query $query ) {
if($query->is_page()) {
if ( isset($query->query_vars[self::QUERY_VAR]) ) {
// make sure we get the right post
$query->query_vars['post_type'] = self::POST_TYPE;
$query->query_vars['p'] = self::get_post_id();
// override any vars WordPress set based on the original query
$query->is_single = TRUE;
$query->is_singular = TRUE;
$query->is_404 = FALSE;
$query->is_home = FALSE;
}
}
}
Might help someone. Again thats for a cracking plugin
Rob
The text was updated successfully, but these errors were encountered:
Hi,
Firstly thanks for a cracking plugin save me hours of coding. On my latest project I started getting the annoying Notice: Undefined property: WP_Query::$post. I always developed with debug to true and this bugged me for a while. In the end I tracked it down to the pre_get_posts call in WP_Router_Page.class.php around line 111. I implemented a simple check to solve my issue
public function edit_query( WP_Query $query ) {
if($query->is_page()) {
if ( isset($query->query_vars[self::QUERY_VAR]) ) {
// make sure we get the right post
$query->query_vars['post_type'] = self::POST_TYPE;
$query->query_vars['p'] = self::get_post_id();
Might help someone. Again thats for a cracking plugin
Rob
The text was updated successfully, but these errors were encountered: