{"id":16913,"date":"2015-04-02T09:30:34","date_gmt":"2015-04-02T09:30:34","guid":{"rendered":"http:\/\/qw\/oikcom\/?page_id=16512"},"modified":"2020-12-01T18:30:12","modified_gmt":"2020-12-01T18:30:12","slug":"support-mapping-of-post-ids-within-content","status":"publish","type":"page","link":"https:\/\/www.oik-plugins.com\/oik-clone\/oik-clone-requirements-summary\/oik-clone-technical-requirements\/support-mapping-of-post-ids-within-content\/","title":{"rendered":"Support mapping of post IDs within content"},"content":{"rendered":"v0.8 of oik-clone is planned to support the mapping of post IDs within content.\r\n\r\nThis means that post IDs used in the source content will be altered to the post IDs of the target content.<!--more-->\r\n\r\n<h3>Requirements<\/h3>\r\n<ul>\r\n<li>Target to map source post IDs to target post IDs within post content<\/li>\r\n<li>Post content fields supported to include: post_content, post_excerpt, post_title and (possibly) post_content_filtered<\/li>\r\n<li>Mapping should also be performed on postmeta fields which support links and\/or shortcode expansion: text, textarea and other specialized fields<\/li>\r\n<li>Mapping to be performed against integers which can be identified as IDs by the context in which they&#8217;re used; parameters to shortcodes, within links.<\/li>\r\n<li>Optional mapping of source to target URLs<\/li>\r\n<li>Ability to prevent mapping, for certain edge cases<\/li>\r\n<\/ul>\r\n\r\n<h3>Example<\/h3>\r\n\r\nSuppose the post content contains the <a class=\"bw_code gallery\" href=\"https:\/\/www.oik-plugins.com\/oik-shortcodes\/gallery\/gallery_shortcode\" title=\"Link to help for shortcode: gallery\"><span>[<\/span>gallery]<\/a> shortcode using the <code>ids=<\/code> parameter.\r\nwhich contains a sequence of post IDs of the attached images to display.\r\n\r\nEach of the source image&#8217;s post IDs will need to be mapped to a different target post ID.\r\n\r\nSo &#8220;gallery ids=s1,s2,s3&#8243; will become &#8220;gallery ids=t1,t2,t3&#8243;\r\n\r\nNote: I&#8217;ve used prefixes to the post IDs to prevent mapping when this requirement gets cloned.\r\n\r\n<h3>Other examples<\/h3>\r\nThere are zillions of shortcodes which use IDs to identify the content to be included or excluded.\r\nHere are just a few examples, again using sn for post IDs and http:\/\/example.com for the source domain\r\nwhich may also need to be mapped.\r\n\r\n<div class=\"bw_geshi html5\"><code><br \/>\n&#091;bw_link s1]<br \/>\n&#091;nivo ids=s1,s2,s3]<br \/>\n&nbsp;<\/code><\/div>\r\n\r\n<div class=\"bw_geshi html5\"><code><br \/>\n<span style=\"color: #009900;\">&lt;<span style=\"color: #000000; font-weight: bold;\">a<\/span> <span style=\"color: #000066;\">href<\/span><span style=\"color: #66cc66;\">=<\/span><span style=\"color: #ff0000;\">&quot;http:\/\/example.com?p=s1&quot;<\/span>&gt;<\/span>Link to s1 on http:\/\/example.com<span style=\"color: #009900;\">&lt;<span style=\"color: #66cc66;\">\/<\/span><span style=\"color: #000000; font-weight: bold;\">li<\/span>&gt;<\/span><br \/>\n&nbsp;<\/code><\/div>\r\n\r\nAnd here are examples where we should not perform mapping since the post IDs are &#8220;out of context&#8221;\r\n<div class=\"bw_geshi html5\"><code><br \/>\n<span style=\"color: #009900;\">&lt;<span style=\"color: #000000; font-weight: bold;\">a<\/span> <span style=\"color: #000066;\">href<\/span><span style=\"color: #66cc66;\">=<\/span><span style=\"color: #ff0000;\">&quot;http:\/\/elsewhere.com?p=s1&quot;<\/span>&gt;<\/span>Link to a different s1 on another domain<span style=\"color: #009900;\">&lt;<span style=\"color: #66cc66;\">\/<\/span><span style=\"color: #000000; font-weight: bold;\">li<\/span>&gt;<\/span><br \/>\nI have been thinking about addressing this problem for nearly s2 years now.<br \/>\n&#091;bw_pages posts_per_page=s3]<br \/>\n&nbsp;<\/code><\/div>\r\n\r\nThere are also examples where we don&#8217;t want mapping \r\n<div class=\"bw_geshi html5\"><code><br \/>\ne.g. The source of this page is http:\/\/example.com\/?p=s1<br \/>\nIt has been cloned to http:\/\/example.biz\/?p=t1<br \/>\n&nbsp;<\/code><\/div>\r\n\r\n\r\n<h3>Proposed solution<\/h3>\r\nSource\r\n<ul>\r\n<li>Parse for IDs in the content<\/li>\r\n<li>For each ID found determine the target mapping<\/li>\r\n<li>Include this in the &#8216;mapping&#8217; array<\/li>\r\n<\/ul>\r\nTarget\r\n<ul>\r\n<li>Parse for IDs in the content<\/li>\r\n<li>For each ID found lookup the target mapping<\/li>\r\n<li>Verify the target mapping<\/li>\r\n<li>Apply the mapping to the content<\/li>\r\n<\/ul>\r\n\r\nThe behaviour when the mapping cannot be completed is currently unspecified.\r\n\r\n\r\n<h3>Exclusions<\/h3>\r\n\r\n<p>The proposed solution doesn&#8217;t take into account all the other instances where unique IDs are used to identify content:\r\n<ul>\r\n<li>IDs associated with taxonomies<\/li>\r\n<li>IDs associated with users<\/li>\r\n<li>IDs associated with <span class=\"wordpress\"><span class=\"bw_word\">Word<\/span><span class=\"bw_press\">Press<\/span><\/span> <span class=\"bw_multisite\">Multisite<\/span> blogs<\/li>\r\n<li>IDs associated with Comments<\/li>\r\n<li>IDs which reference content in custom tables<\/li>\r\n<li>IDs stored in the options table<\/li>\r\n<\/ul>\r\n\r\n<p>The proposed solution doesn&#8217;t cater for logic which ensures that slug names are unique<\/p>\r\n\r\n<a class=\"bw_parent\" id=\"id-16885\" href=\"https:\/\/www.oik-plugins.com\/oik-clone\/oik-clone-requirements-summary\/oik-clone-technical-requirements\/\">oik-clone <span class=\"summary\">&#8211; Technical requirements<\/span><\/a>\r\n<ul><li><a class=\"bw_tree\" href=\"https:\/\/www.oik-plugins.com\/oik-clone\/oik-clone-requirements-summary\/oik-clone-technical-requirements\/support-cloning-of-hierarchical-content\/\">Support cloning of hierarchical content<\/a><\/li><li><a class=\"bw_tree\" href=\"https:\/\/www.oik-plugins.com\/oik-clone\/oik-clone-requirements-summary\/oik-clone-technical-requirements\/support-complex-relationships-between-content\/\">Support complex relationships between content<\/a><\/li><li><a class=\"bw_tree\" href=\"https:\/\/www.oik-plugins.com\/oik-clone\/oik-clone-requirements-summary\/oik-clone-technical-requirements\/support-pushing-of-media-files-with-attachments\/\">Support pushing of media files with attachments<\/a><\/li><li><a class=\"bw_tree\" href=\"https:\/\/www.oik-plugins.com\/oik-clone\/oik-clone-requirements-summary\/oik-clone-technical-requirements\/support-pushing-of-media-files-using-multipart-forms\/\">Support pushing of media files using multipart forms<\/a><\/li><\/ul>\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n","protected":false},"excerpt":{"rendered":"<p>v0.8 of oik-clone is planned to support the mapping of post IDs within content.<\/p>\n<p>This means that post IDs used in the source content will be altered to the post IDs of the target content.<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":16885,"menu_order":80,"comment_status":"closed","ping_status":"closed","template":"","meta":{"_acf_changed":false,"_genesis_hide_title":false,"_genesis_hide_breadcrumbs":false,"_genesis_hide_singular_image":false,"_genesis_hide_footer_widgets":false,"_genesis_custom_body_class":"","_genesis_custom_post_class":"","_genesis_layout":"","footnotes":""},"letters":[534],"class_list":{"0":"post-16913","1":"page","2":"type-page","3":"status-publish","5":"letters-s","6":"entry"},"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.0 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Support mapping of post IDs within content - [oik] plugins.com<\/title>\n<meta name=\"description\" content=\"Summary of requirements for mapping of post IDs in content during cloning.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.oik-plugins.com\/oik-clone\/oik-clone-requirements-summary\/oik-clone-technical-requirements\/support-mapping-of-post-ids-within-content\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Support mapping of post IDs within content - [oik] plugins.com\" \/>\n<meta property=\"og:description\" content=\"Summary of requirements for mapping of post IDs in content during cloning.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.oik-plugins.com\/oik-clone\/oik-clone-requirements-summary\/oik-clone-technical-requirements\/support-mapping-of-post-ids-within-content\/\" \/>\n<meta property=\"og:site_name\" content=\"[oik] plugins.com\" \/>\n<meta property=\"article:modified_time\" content=\"2020-12-01T18:30:12+00:00\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.oik-plugins.com\/oik-clone\/oik-clone-requirements-summary\/oik-clone-technical-requirements\/support-mapping-of-post-ids-within-content\/\",\"url\":\"https:\/\/www.oik-plugins.com\/oik-clone\/oik-clone-requirements-summary\/oik-clone-technical-requirements\/support-mapping-of-post-ids-within-content\/\",\"name\":\"Support mapping of post IDs within content - [oik] plugins.com\",\"isPartOf\":{\"@id\":\"https:\/\/www.oik-plugins.com\/#website\"},\"datePublished\":\"2015-04-02T09:30:34+00:00\",\"dateModified\":\"2020-12-01T18:30:12+00:00\",\"description\":\"Summary of requirements for mapping of post IDs in content during cloning.\",\"breadcrumb\":{\"@id\":\"https:\/\/www.oik-plugins.com\/oik-clone\/oik-clone-requirements-summary\/oik-clone-technical-requirements\/support-mapping-of-post-ids-within-content\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.oik-plugins.com\/oik-clone\/oik-clone-requirements-summary\/oik-clone-technical-requirements\/support-mapping-of-post-ids-within-content\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.oik-plugins.com\/oik-clone\/oik-clone-requirements-summary\/oik-clone-technical-requirements\/support-mapping-of-post-ids-within-content\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"oik-clone\",\"item\":\"https:\/\/www.oik-plugins.com\/oik-clone\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"oik-clone &#8211; Requirements summary\",\"item\":\"https:\/\/www.oik-plugins.com\/oik-clone\/oik-clone-requirements-summary\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"oik-clone &#8211; Technical requirements\",\"item\":\"https:\/\/www.oik-plugins.com\/oik-clone\/oik-clone-requirements-summary\/oik-clone-technical-requirements\/\"},{\"@type\":\"ListItem\",\"position\":4,\"name\":\"Support mapping of post IDs within content\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.oik-plugins.com\/#website\",\"url\":\"https:\/\/www.oik-plugins.com\/\",\"name\":\"[oik] plugins.com\",\"description\":\"WordPress plugins and themes\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.oik-plugins.com\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Support mapping of post IDs within content - [oik] plugins.com","description":"Summary of requirements for mapping of post IDs in content during cloning.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.oik-plugins.com\/oik-clone\/oik-clone-requirements-summary\/oik-clone-technical-requirements\/support-mapping-of-post-ids-within-content\/","og_locale":"en_US","og_type":"article","og_title":"Support mapping of post IDs within content - [oik] plugins.com","og_description":"Summary of requirements for mapping of post IDs in content during cloning.","og_url":"https:\/\/www.oik-plugins.com\/oik-clone\/oik-clone-requirements-summary\/oik-clone-technical-requirements\/support-mapping-of-post-ids-within-content\/","og_site_name":"[oik] plugins.com","article_modified_time":"2020-12-01T18:30:12+00:00","twitter_misc":{"Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.oik-plugins.com\/oik-clone\/oik-clone-requirements-summary\/oik-clone-technical-requirements\/support-mapping-of-post-ids-within-content\/","url":"https:\/\/www.oik-plugins.com\/oik-clone\/oik-clone-requirements-summary\/oik-clone-technical-requirements\/support-mapping-of-post-ids-within-content\/","name":"Support mapping of post IDs within content - [oik] plugins.com","isPartOf":{"@id":"https:\/\/www.oik-plugins.com\/#website"},"datePublished":"2015-04-02T09:30:34+00:00","dateModified":"2020-12-01T18:30:12+00:00","description":"Summary of requirements for mapping of post IDs in content during cloning.","breadcrumb":{"@id":"https:\/\/www.oik-plugins.com\/oik-clone\/oik-clone-requirements-summary\/oik-clone-technical-requirements\/support-mapping-of-post-ids-within-content\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.oik-plugins.com\/oik-clone\/oik-clone-requirements-summary\/oik-clone-technical-requirements\/support-mapping-of-post-ids-within-content\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.oik-plugins.com\/oik-clone\/oik-clone-requirements-summary\/oik-clone-technical-requirements\/support-mapping-of-post-ids-within-content\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"oik-clone","item":"https:\/\/www.oik-plugins.com\/oik-clone\/"},{"@type":"ListItem","position":2,"name":"oik-clone &#8211; Requirements summary","item":"https:\/\/www.oik-plugins.com\/oik-clone\/oik-clone-requirements-summary\/"},{"@type":"ListItem","position":3,"name":"oik-clone &#8211; Technical requirements","item":"https:\/\/www.oik-plugins.com\/oik-clone\/oik-clone-requirements-summary\/oik-clone-technical-requirements\/"},{"@type":"ListItem","position":4,"name":"Support mapping of post IDs within content"}]},{"@type":"WebSite","@id":"https:\/\/www.oik-plugins.com\/#website","url":"https:\/\/www.oik-plugins.com\/","name":"[oik] plugins.com","description":"WordPress plugins and themes","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.oik-plugins.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"}]}},"_links":{"self":[{"href":"https:\/\/www.oik-plugins.com\/wp-json\/wp\/v2\/pages\/16913","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.oik-plugins.com\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/www.oik-plugins.com\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/www.oik-plugins.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.oik-plugins.com\/wp-json\/wp\/v2\/comments?post=16913"}],"version-history":[{"count":1,"href":"https:\/\/www.oik-plugins.com\/wp-json\/wp\/v2\/pages\/16913\/revisions"}],"predecessor-version":[{"id":40658,"href":"https:\/\/www.oik-plugins.com\/wp-json\/wp\/v2\/pages\/16913\/revisions\/40658"}],"up":[{"embeddable":true,"href":"https:\/\/www.oik-plugins.com\/wp-json\/wp\/v2\/pages\/16885"}],"wp:attachment":[{"href":"https:\/\/www.oik-plugins.com\/wp-json\/wp\/v2\/media?parent=16913"}],"wp:term":[{"taxonomy":"letters","embeddable":true,"href":"https:\/\/www.oik-plugins.com\/wp-json\/wp\/v2\/letters?post=16913"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}