biga85
Forum Replies Created
-
I found a solution.
In plugins file “class_core.php” under function “parse_request( $query )” at the end before line “return $query;” need to write:if (is_user_logged_in()){ $query->query_vars[ 'post_status' ] = 'private, publish'; }Off course, probably it is not enough to have only this code. I have many places in plugin where I changed SQL from post_type -> “publish” to post_type -> “pubish, private”…
But now I can sleep better 🙂
I added code that it can be publish or private in parse_request() function and SQL looks good, but still page not found. Then I see another SQL in debuging with only publish status:
SELECT ID FROM wp_posts WHERE post_name LIKE '2-kamb-naujakiemio-g-47-kv-26000-eur%' AND post_type = 'property' AND post_status = 'publish'under:
redirect_guess_404_permalink()
wp-includes/canonical.php:553
redirect_canonical()
wp-includes/canonical.php:146
do_action(‘template_redirect’)
wp-includes/plugin.php:503before that it was SQL without any status:
SELECT * FROM wp_posts WHERE post_name = '2-kamb-naujakiemio-g-47-kv-26000-eur' AND post_type = 'property' LIMIT 0, 1WPP_F::posts_results()
wp-content/plugins/wp-property/lib/class_functions.php:1010Yes, this only happens to private properties, but NOT to posts and pages.
Permalinks is ok – “postname”.I tried to debug and I think that the problem is on function parse_request in class_core.php. There is a line ~410 where checking “!is_admin()” and then “hack” to open right page template goes. There is provided info for query, but there is not provided post status for query and later wp->query thinks it should be public, at least SQL in debuging looks like this:
SELECT wp_posts.* FROM wp_posts WHERE 1=1 AND wp_posts.post_name = '2-kamb-naujakiemio-g-47-kv-26000-eur' AND wp_posts.post_type = 'page' AND (<strong>(wp_posts.post_status = 'publish')</strong>) ORDER BY wp_posts.post_date DESCunder:
WP_Query->get_posts()
wp-includes/query.php:3499
–
WP_Query->query()
wp-includes/query.php:3874
get_posts()
wp-includes/post.php:1903
WPP_Core->parse_request()
wp-content/plugins/wp-property/lib/class_core.php:436
do_action_ref_array(‘parse_request’)
wp-includes/plugin.php:579
WP->parse_request()
wp-includes/class-wp.php:339
WP->main()
wp-includes/class-wp.php:620
wp()
wp-includes/functions.php:886