{"id":5001,"date":"2017-05-17T20:36:43","date_gmt":"2017-05-17T19:36:43","guid":{"rendered":"http:\/\/johnjohnston.info\/blog\/?p=5001"},"modified":"2017-05-17T20:36:43","modified_gmt":"2017-05-17T19:36:43","slug":"wordpress-menus-fixed-fault-mine-mine-alone","status":"publish","type":"post","link":"https:\/\/johnjohnston.info\/blog\/wordpress-menus-fixed-fault-mine-mine-alone\/","title":{"rendered":"WordPress menus fixed, fault mine &#038; mine alone"},"content":{"rendered":"<p>I just updated my blog to the latest version of WordPress.<\/p>\n<p>All seemed fine until I had a look at the site. Some of\u00a0my menus had went a little weird.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" data-attachment-id=\"5002\" data-permalink=\"https:\/\/johnjohnston.info\/blog\/wordpress-menus-fixed-fault-mine-mine-alone\/weirdmenus-png\/\" data-orig-file=\"https:\/\/johnjohnston.info\/blog\/wp-content\/uploads\/2017\/05\/weirdmenus.png.gif\" data-orig-size=\"900,106\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"weirdmenus.png\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/johnjohnston.info\/blog\/wp-content\/uploads\/2017\/05\/weirdmenus.png.gif\" class=\"aligncenter size-full wp-image-5002\" src=\"https:\/\/johnjohnston.info\/blog\/wp-content\/uploads\/2017\/05\/weirdmenus.png.gif\" alt=\"\" width=\"900\" height=\"106\" \/><\/p>\n<p>Quite a few of the titles had changed to ellipses! I went into the dashboard and changed them back, my changes didn&#8217;t stick. I presumed that it must have been the upgrade. I had no idea where to start so shot off a quick tweet for help.<\/p>\n<p>After dinner I calmed down a little and though about the changes to my blog I&#8217;d made recently for mico blogging. One of those was to give posts without a title titles on wp_insert_post_data. It uses ellipse! This was meant for posts arriving from the micro.blog app. They would get titles set when they arrived on my blog, to prevent ugliness in he dashboard.<\/p>\n<pre><code>\nfunction modify_post_title($data)\n{\n    if ($data[ 'post_title' ] == ''  ) {\n        \/\/wp_filter_nohtml_kses strips html and then I replace &amp;nbsp; \n        $title = str_replace( \"&amp;nbsp;\" , \" \" , substr( wp_filter_nohtml_kses( $data[ 'post_content' ] ) , 0, 60 ) ) . \"...\" ;\n        $data['post_title'] =  $title ;\n    }\n    return $data; \/\/ Returns the modified data.\n} \n<\/code><\/pre>\n<p>so I&#8217;ve changed the if to:<br \/>\n<code>\tif ($data[ 'post_title' ] == '' &amp;&amp; $data[ 'post_type' ] == 'post' )<\/code><\/p>\n<p>Which seems to have solved the problem and taught me a lesson.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I just updated my blog to the latest version of WordPress. All seemed fine until I had a look at the site. Some of\u00a0my menus had went a little weird. Quite a few of the titles had changed to ellipses! I went into the dashboard and changed them back, my changes didn&#8217;t stick. I presumed [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"mf2_syndication":[],"advanced_seo_description":"","jetpack_seo_html_title":"","jetpack_seo_noindex":false,"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"webmentions_disabled_pings":false,"webmentions_disabled":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[660,6],"tags":[664,11],"post_format":[],"class_list":{"0":"post-5001","1":"post","2":"type-post","3":"status-publish","4":"format-standard","6":"category-micro","7":"category-wwwd","8":"tag-micro-blog","9":"tag-wordpress","10":"kind-note","12":"h-entry","13":"hentry"},"better_featured_image":null,"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/p57zFQ-1iF","jetpack_likes_enabled":false,"jetpack_sharing_enabled":true,"kind":false,"_links":{"self":[{"href":"https:\/\/johnjohnston.info\/blog\/wp-json\/wp\/v2\/posts\/5001","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/johnjohnston.info\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/johnjohnston.info\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/johnjohnston.info\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/johnjohnston.info\/blog\/wp-json\/wp\/v2\/comments?post=5001"}],"version-history":[{"count":3,"href":"https:\/\/johnjohnston.info\/blog\/wp-json\/wp\/v2\/posts\/5001\/revisions"}],"predecessor-version":[{"id":5005,"href":"https:\/\/johnjohnston.info\/blog\/wp-json\/wp\/v2\/posts\/5001\/revisions\/5005"}],"wp:attachment":[{"href":"https:\/\/johnjohnston.info\/blog\/wp-json\/wp\/v2\/media?parent=5001"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/johnjohnston.info\/blog\/wp-json\/wp\/v2\/categories?post=5001"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/johnjohnston.info\/blog\/wp-json\/wp\/v2\/tags?post=5001"},{"taxonomy":"post_format","embeddable":true,"href":"https:\/\/johnjohnston.info\/blog\/wp-json\/wp\/v2\/post_format?post=5001"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}