[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

oik_clone_attempt_import() – Import the contents into the target post

You appear to be a bot. Output may be restricted

Description

Import the contents into the target post

Attempt to load the post that's been asked for. If the target post is what we hope it is. If it's not then we have to decide:

  • Do we try to find the matching post
  • or should we already know it
If we should already know it then it should have been listed in the post meta data on the client. Maybe we should have loaded the post by guid in the first place.

Usage

oik_clone_attempt_import( $source, $target, $post );

Parameters

$source
( ID ) required – the ID of the source post
$target
( ID ) required – the ID of the target post
$post
( array ) required – the post to clone

Returns

void

Source

File name: oik-clone/admin/oik-clone-clone.php
Lines:
1 to 58 of 58
function oik_clone_attempt_import( $source, $target, $post ) {

  oik_require( "admin/oik-clone-actions.php", "oik-clone" );
  oik_require( "admin/oik-clone-relationships.php", "oik-clone" );
  $media_file = null;
  kses_remove_filters();

  oik_clone_cloning_in_progress( true );
  
  
  $target_id = oik_clone_determine_target_id( $source, $target, $post );
  if ( $target_id ) {
    $target_post = oik_clone_load_target( $target_id );
    if ( $target_post ) {
      $post = oik_clone_apply_mapping( $post );
      oik_clone_update_target( $post, $target_id ); 
    } else {
      p( "That's odd" );
    }  
  } else {
    p( "Looks like we'll have to create it" );
    
    $post = oik_clone_apply_mapping( $post );
    
    $target_id = oik_clone_insert_post( $post );
  }
  
  
  if ( $post->post_type == "attachment" ) {
    oik_require( "admin/oik-clone-media.php", "oik-clone" );
    $saved_post_id = bw_array_get( $_REQUEST, 'post_id', null );
    bw_trace2( $saved_post_id, "saved post_id", true );
    $_REQUEST['post_id'] = $post->post_parent;
    $upload_date = oik_clone_get_upload_month( $post->post_meta->_wp_attached_file[0] );
    $media_file = oik_clone_save_media_file( $upload_date, $post ); //$post->post_date );
    $post->file = $media_file['file'];
    if ( $saved_post_id ) {
      $_REQUEST['post_id'] = $saved_post_id;
    }
  }
  
  oik_clone_update_post_meta( $post, $target_id );
  
  if ( $target_id && $media_file ) {
     oik_clone_update_attachment_metadata( $target_id, $media_file['file'] );
  }
  oik_clone_update_taxonomies( $post, $target_id );
  
  // update the post meta with the master post ID of the source ... regardless of the current source
  // Can we trust [HTTP_USER_AGENT] => WordPress/4.1.1; http://qw/oikcom ?
  // If not we'll have to pass it.
  // Or get it from???
  oik_require( "admin/oik-save-post.php", "oik-clone" );
  $master = bw_array_get( $_REQUEST, "master", null );
  oik_clone_update_slave_target( $target_id, $master, $source, $post->post_modified_gmt );
  oik_clone_cloning_in_progress( false );
  return( $target_id );
}
 
 View on GitHub

Published: November 1, 2016 | Last updated: November 1, 2016

Information

Function name: oik_clone_attempt_import
Plugin ref: oik-clone – clone your WordPress content
Version: 2.1.1
Sourcefile: admin/oik-clone-clone.php
File ref: admin/oik-clone-clone.php
Deprecated?: No
API Letters:

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