[oik] plugins.com

WordPress plugins and themes

  • Home
  • About
    • lazy shortcodes
    • smart shortcodes
    • oik base plugin
      • oik – donate
      • oik PayPal buttons
      • oik installation
      • oik Button Shortcode button
      • oik changelog
      • oik FAQ
      • oik plugins on SVN
      • oik plugins on GitHub
  • Plugins
    • oik base plugin
    • FREE oik plugins
    • WordPress plugins
    • Premium oik plugins
    • Bespoke oik plugins
  • Shortcodes
    • Shortcode examples
  • Blocks
    • Block examples
  • APIs
    • ALL action and filter hooks
  • Blog
You are here: Home / oik-clone / oik-clone – Requirements summary / oik-clone – Technical requirements / Support complex relationships between content

Support complex relationships between content

When a post is cloned from one site to another then the chances are that it will get a different ID on the target site. Q. So what do you do if a post has relationships to another post?
A. You need to be able to point to the correct post on the target site. i.e. there is a need to support complex relationships between content.

Requirements

  • When content is cloned any relationships with other content should be maintained

Simple relationships in WordPress core

  • Post parent
  • Featured image
The simplest example of a relationship with another post is the post->post_parent relationship.
  • Hierarchical post types such as pages use this relationship
  • Attachments created using Add Media are created with a post_parent of the current post
WordPress core also supports the Featured image relationship, maintained in post meta data, keyed by _thumbnail_id.

Complex relationships ( extensions )

  • Other post meta data fields may contain one or more references to other posts by post ID
  • Each source post ID needs to be mapped to the correct target ID
  • The server should ensure consistency of the mapping from source to target ID
This requirement was satisfied in oik-clone v0.5

Solution

We achieve this by passing a simple array of source to target IDs. e.g. for post 16878, which originally had no parent when cloned to 29936, but was then given one, the array we pass to the server may consist of:
source target which is
16878 29936 A simple mapping of the current post – it may be easier to use than accessing target
4941 0 Post parent – not known to have been cloned
16362 0 Featured image ( _thumbnail_id )
2384 0 Plugin reference ( _plugin_ref ) – a field of type “noderef”
The solution makes use of post meta data keyed by _oik_clone_ids.
  • For each item of content that has been cloned, oik-clone stores the target server and post ID in post meta data keyed by ‘_oik_clone_ids’
  • When the content is recloned this ID is passed to the server as the preferred target
  • The server will then match this target
  • For any source post IDs which are found in relationships oik-clone will build a mapping table of source to target post IDs
  • This mapping table will be passed to the server
  • oik-clone has built-in support for:
    • _thumbnail_id
    • “noderef” fields – recognised by oik base functions
  • Use oik_clone_build_list filter to include your own mappings

Assumptions

  • When any content is cloned, the content referenced in the relationships will also be cloned

Limitations

  • Only supports relationships in post meta data
  • Where relationships are cyclical cloning may need to be performed more than once
  • Does not support post references maintained through slugs, URLs or HTML links
  • Does not support yet support oik custom image link fields ( _bw_image_link )
  • Any extension plugin is needed in both source and target servers

Published: April 4, 2015 | Last updated: December 1, 2020

Information

Component:
  • oik-clone – clone your WordPress content
Letters: S

Recent plugin updates

oik v4.7.2 oik v4.7.2 includes a fix to the logic to render blocks for Content and Excerpts in the bw_pages shortcode. ...
oik v4.7.1 Upgrade to oik v4.7.1 for bw_pages rendering blocks for Content and Excerpts, and support for post_name attribute for shortcode which query posts ...
oik-shortcodes v1.41.1 Upgrade to oik-shortcodes v1.41.1 for a couple of minor changes. ...
oik-bob-bing-wide v2.2.2 Upgrade to oik-bob-bing-wide v2.2.2 for improvements to bw_dash examples and fixes to some SVG icon's visibility. ...
oik-bwtrace v3.3.1 Upgrade to oik-bwtrace v3.3.1 to measure plugin load times and ad hoc action timing points. ...

Plugins

  • All Plugins
  • oik base plugin
  • FREE oik plugins
  • WordPress plugins
  • Premium oik plugins

Themes

  • FREE themes
  • Bespoke themes
  • Premium themes

Blocks

  • All Blocks
  • Block examples
  • About Blocks

Shortcodes

  • All Shortcodes
  • Shortcode examples
  • About Shortcodes

Reference

  • About APIs
  • All APIs
  • All Classes
  • All Files
  • All Hooks

Support

  • Contact
  • Cookies policy
  • Get API key
  • Privacy
  • Request support
  • Sitemap
  • Stay informed
  • Terms and Conditions
oik-plugins
Email: [email protected]

Weight shipping plugins

Find out which cart weight shipping plugin you need for your WooCommerce site.
Which cart weight based plugin do I need?

Site:  www.oik-plugins.com
© Copyright oik-plugins 2011-2022. All rights reserved.


Website designed and developed by Herb Miller of Bobbing Wide
Proudly powered by WordPress and oik-plugins
WordPress 6.0. PHP: 7.4.30. Memory limit: 768M