Forum Replies Created
-
AuthorPosts
-
mindmantraParticipantHad same problem. Investigated a lot and came to conclusion to replacing the $pagenow comparison with ‘1’ would work without any issue.
So
<?php touch_time(($action == 'edit'), ($pagenow != 'post-new.php'), 4); ?>
would become
<?php touch_time(($action == 'edit'), 1, 4); ?>reason to put $pagenow check (only on post-new.php?) is beyond my understanding.
@steve or @kevin may put some light into this!
October 20, 2016 at 2:02 am in reply to: Trying to get property of non-object (Clean install) when adding CPT #7449
mindmantraParticipantHi, Had the same issue.
The culprit is touch_time args passed in
piklist\parts\meta-boxes\submitdiv.php line 218
touch_time(($action == 'edit'), ($pagenow != 'post-new.php'), 4)This metabox is extending and “replacing” the
post_submit_meta_boxfromwp-admin\includes\meta-boxes.php. If I’m not wrong this is only available in custom-post-types set by piklist function to add support for custom post statuses.Here’s the core issue, while original metabox in wp-admin sets
touch_time( ( $action === 'edit' ), 1 );replaced one in custom metabox by piklist tries to be smart to see if it’s NOT(?) on post-new.php page (are the datetime form fields are for-post or for-comments).Here’s the actual function being called
touch_time( $edit = 1, $for_post = 1, $tab_index = 0, $multi = 0 )from ‘wp-admin\includes\template.php:684’. <b>$for_post</b> argument is tricky one. If it’s set for false then it forces touch_time to retrieve date for comment instead of post. (see line:700$post_date = ($for_post) ? $post->post_date : get_comment()->comment_date;). <b><–this causes non-object error</b>What I’m not sure why check for ‘not equal’ where it should check for equal? This is causing touch_time getting second argument as false when on post-new.php thus calling get_comment() function on post context.
Replacing
!=with==in touch_time() of piklist submitdiv.php solved the issue for me. -
AuthorPosts