wp-user-frontend icon indicating copy to clipboard operation
wp-user-frontend copied to clipboard

Warning: Attempt to read property

Open DivvyPT opened this issue 1 year ago • 1 comments

I have the following warnings in my site:

Warning: Attempt to read property "ID" on null in /home/username/public_html/wp-content/plugins/wp-user-frontend/wpuf-functions.php on line 4580

Code: $user_id = get_post_meta( get_post()->ID, '_edit_last', true );

Warning: Attempt to read property "ID" on null in /home/username/public_html/wp-content/plugins/wp-user-frontend/class/payment.php on line 87

Code: if ( $post->ID === $pay_page && $action === 'wpuf_pay' ) {

Can someone help me fix these, please?

Thank you

DivvyPT avatar Nov 16 '23 10:11 DivvyPT

Hello @DivvyPT,

sorry to hear about your problem. Let's do a conflict test to be confirmed if there is any conflict.

Please deactivate all plugins except the WP User Frontend and WP User Frontend Pro. Use a default theme such as twenty-twenty-three. Clear your site cache as well as the browser cache. Then try again.

There is another work-around you can use. Please add below code on line no: 4578 of wp-content/plugins/wp-user-frontend/wpuf-functions.php

$post = get_post();

if ( ! ( $post instanceof WP_Post ) ) {
    return $content;
}

Please add below code on line no: 66 of wp-content/plugins/wp-user-frontend/class/payment.php

if ( ! ( $post instanceof WP_Post ) ) {
    return $content;
}

If you're still getting that problem, please contact our support so that we can check it in every possible way.

sapayth avatar Nov 17 '23 04:11 sapayth