{"id":2430,"date":"2012-01-06T19:46:43","date_gmt":"2012-01-06T17:46:43","guid":{"rendered":"http:\/\/mummila.net\/kommentit\/?p=2430"},"modified":"2012-01-06T19:57:19","modified_gmt":"2012-01-06T17:57:19","slug":"inserting-newlines","status":"publish","type":"post","link":"https:\/\/mummila.net\/kommentit\/2012\/01\/06\/inserting-newlines\/","title":{"rendered":"Inserting newlines"},"content":{"rendered":"<p>There was a topic about <a href=\"http:\/\/urbangiraffe.com\/support\/topic\/replace-ltbr-gt-with-newline\">replacing br tags with newlines on Urban Giraffe<\/a>, but it seems to have led nowhere, so I&#8217;m posting this here just so that I can find it when I again need it, and maybe of help to others too.<\/p>\n<p>I modified the search_and_replace function on line 37 of models\/search.php so that $this->replace is assigned a replaced string itself:<\/p>\n<pre>$this->replace = str_replace(\"\\\\n\", '\r\n', $replace);<\/pre>\n<p>This means I want to replace any occurences of &#8221;\\n&#8221;&#8217;s in my replacement string with actual newlines just prior to applying the replacement.<\/p>\n<p>It&#8217;s an ad hoc solution which I&#8217;m reverting once I&#8217;m done with newlines. I&#8217;ve not explored any possible side effects this solution may have, so use with caution.<\/p>\n<p><strong>Edit:<\/strong> Forum ate my br.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>There was a topic about replacing with newlines on UG, but it seems to have led nowhere, so I&#8217;m posting this here just so that I can find it when I again need it, and maybe of help to others too.<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1097],"tags":[2965],"class_list":["post-2430","post","type-post","status-publish","format-standard","hentry","category-keskustelupalstat","tag-wordpress","sijainti-wordpress-support-forums"],"_links":{"self":[{"href":"https:\/\/mummila.net\/kommentit\/wp-json\/wp\/v2\/posts\/2430","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\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mummila.net\/kommentit\/wp-json\/wp\/v2\/comments?post=2430"}],"version-history":[{"count":6,"href":"https:\/\/mummila.net\/kommentit\/wp-json\/wp\/v2\/posts\/2430\/revisions"}],"predecessor-version":[{"id":2436,"href":"https:\/\/mummila.net\/kommentit\/wp-json\/wp\/v2\/posts\/2430\/revisions\/2436"}],"wp:attachment":[{"href":"https:\/\/mummila.net\/kommentit\/wp-json\/wp\/v2\/media?parent=2430"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mummila.net\/kommentit\/wp-json\/wp\/v2\/categories?post=2430"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mummila.net\/kommentit\/wp-json\/wp\/v2\/tags?post=2430"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}