Tagged: ,

Viewing 5 reply threads
  • Author
    Posts
    • #6667
      jivedig
      Member

      Any website I use Piklist (trunk, haven’t tried repo version) has a “Trying to get property of non-object” via Query Monitor.

      It appears to only happen when trying to add a new (custom post type) post. I tested on Twenty Sixteen theme and various Genesis child themes and the error remains.

      Attachments:
      You must be logged in to view attached files.
    • #6681
      Jason
      Keymaster

      Hey @jivedig!

      Interesting. The touch_time function isn’t used by a theme; it’s an admin-side function, so changing themes (as you found) wouldn’t have any affect. Still, I just tried this out locally and I’m not having the same issue. Perhaps something is misconfigured where you’re defining the post type?

      Have you tried debugging the line in template.php to see if you can get more information on the variable that’s supposed to be an object?

    • #7072
      vavakco
      Member

      same problem :
      Link my error

    • #7073
      vavakco
      Member

      I just happen to common problem, but I really don’t know why !!?

      with load_textdomain_mofile filter, change some plugin but when disable this function there was not error to be publish post. i just replace .mo file with default piklist language address.

      Who has the problem?

    • #7449
      mindmantra
      Participant

      Hi, 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_box from wp-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.

    • #7475
      Steve
      Keymaster
Viewing 5 reply threads
  • You must be logged in to reply to this topic.