admin管理员组

文章数量:1394171

time. Last week I updated to version 7.0 of php and from there it is giving me the following errors:

Notice: Trying to get property 'ID' of non-object in web_URL/wp-content/themes/stellenportal/tool-box.php on line 33

Notice: Trying to get property 'post_author' of non-object in web_URL/wp-content/themes/stellenportal/tool-box.php on line 34

Here's my code:

at the beginning of the PHP file:

     $job_id       = isset( $_GET['job_id'] ) ? $_GET['job_id'] : false;

Line 32, Line 33:

     $job = get_post($job_id);
     $job_id = $job->ID;

Line 34

     if ( is_user_logged_in() && $current_user->ID === intval( $job->post_author ) || current_user_can( 'administrator' ) || is_admin() ) :

I have read that this is due to a change in php 7.2, but I do not give the correct form. Can somebody help me? Thank you

本文标签: phpTrying to get property 39ID39 and 39postauthor39 of nonobject error