{"id":5763,"date":"2018-08-12T18:18:15","date_gmt":"2018-08-12T15:18:15","guid":{"rendered":"http:\/\/mummila.net\/kommentit\/?p=5763"},"modified":"2018-08-12T18:18:15","modified_gmt":"2018-08-12T15:18:15","slug":"undefined-property-stdclasspost_type-when-adding-a-link","status":"publish","type":"post","link":"https:\/\/mummila.net\/kommentit\/2018\/08\/12\/undefined-property-stdclasspost_type-when-adding-a-link\/","title":{"rendered":"Undefined property: stdClass::$post_type when adding a Link"},"content":{"rendered":"<p>The plugin refers to\u00a0<code>$post-&gt;post_type<\/code>\u00a0before testing it exists, which triggers an error for WP&#8217;s built-in (though hidden-by-default since forever) &#8221;link&#8221; post type. The error appears quite harmless, as it doesn&#8217;t seem to interfere with the link editor&#8217;s functionality in any way.<\/p>\n<h1>Setup<\/h1>\n<ul>\n<li>Simple Tags version 2.4.7<\/li>\n<li>WP version 4.9.8<\/li>\n<li>PHP version 5.6.33<\/li>\n<\/ul>\n<h1>Steps to reproduce<\/h1>\n<ol>\n<li>Set\u00a0<code>WP_DEBUG<\/code>\u00a0on (define as\u00a0<code>true<\/code>)<\/li>\n<li>Enable WordPress&#8217; link manager (<code>add_filter( 'pre_option_link_manager_enabled', '__return_true' );<\/code>),<\/li>\n<li>Go to\u00a0<code>Links &gt; Add New<\/code><\/li>\n<\/ol>\n<h1>What happens<\/h1>\n<p>Simple Tags&#8217; Settings box in the sidebar shows the following notices:<\/p>\n<pre><code>Notice: Undefined property: stdClass::$post_type in [path to wp]\/wp-content\/plugins\/simple-tags\/inc\/class.admin.post.php on line 46\r\nNotice: Undefined property: stdClass::$post_type in [path to wp]\/wp-content\/plugins\/simple-tags\/inc\/class.admin.post.php on line 54\r\n<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Reference to $post-&gt;post_type triggers an error for WP&#8217;s built-in (though hidden-by-default since forever) &#8221;link&#8221; post type under certain conditions.<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[8860],"tags":[2965],"class_list":["post-5763","post","type-post","status-publish","format-standard","hentry","category-vianhallintajarjestelmat","tag-wordpress","sijainti-github"],"_links":{"self":[{"href":"https:\/\/mummila.net\/kommentit\/wp-json\/wp\/v2\/posts\/5763","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/mummila.net\/kommentit\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mummila.net\/kommentit\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mummila.net\/kommentit\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/mummila.net\/kommentit\/wp-json\/wp\/v2\/comments?post=5763"}],"version-history":[{"count":2,"href":"https:\/\/mummila.net\/kommentit\/wp-json\/wp\/v2\/posts\/5763\/revisions"}],"predecessor-version":[{"id":5765,"href":"https:\/\/mummila.net\/kommentit\/wp-json\/wp\/v2\/posts\/5763\/revisions\/5765"}],"wp:attachment":[{"href":"https:\/\/mummila.net\/kommentit\/wp-json\/wp\/v2\/media?parent=5763"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mummila.net\/kommentit\/wp-json\/wp\/v2\/categories?post=5763"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mummila.net\/kommentit\/wp-json\/wp\/v2\/tags?post=5763"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}