[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_lazy_update_taxonomies() – Update the taxonomies for the post

You appear to be a bot. Output may be restricted

Description

Update the taxonomies for the post

Usage

oik_clone_lazy_update_taxonomies( $post, $target );

Parameters

$post
( array ) required – the source post object
$target
( ID ) required – the ID of the target post The source post may send an array like this
[post_taxonomies] => stdClass Object 
( 
[required_version] => Array 
( 
[0] => stdClass Object 
( 
[term_id] => 347 
[name] => 4.0 
[slug] => 4-0 
[term_group] => 0 
[term_taxonomy_id] => 381 
[taxonomy] => required_version 
[description] => 
[parent] => 0 
[count] => 2 
[filter] => raw 
) 
) 
[compatible_up_to] => Array 
( 
[0] => stdClass Object 
( 
[term_id] => 317 
[name] => 4.0 
[slug] => 4-0 
[term_group] => 0 
[term_taxonomy_id] => 349 
[taxonomy] => compatible_up_to 
[description] => 
[parent] => 0 
[count] => 38 
[filter] => raw 
) 
[1] => stdClass Object 
( 
[term_id] => 341 
[name] => 4.0.1 
[slug] => 4-0-1 
[term_group] => 0 
[term_taxonomy_id] => 375 
[taxonomy] => compatible_up_to 
[description] => 
[parent] => 317 
[count] => 16 
[filter] => raw 
) 
[2] => stdClass Object 
( 
[term_id] => 345 
[name] => 4.1 
[slug] => 4-1 
[term_group] => 0 
[term_taxonomy_id] => 379 
[taxonomy] => compatible_up_to 
[description] => 
[parent] => 0 
[count] => 15 
[filter] => raw 
) 
[3] => stdClass Object 
( 
[term_id] => 348 
[name] => 4.1.1 
[slug] => 4-1-1 
[term_group] => 0 
[term_taxonomy_id] => 382 
[taxonomy] => compatible_up_to 
[description] => 
[parent] => 345 
[count] => 3 
[filter] => raw 
) 
) 
) 
The target post may have an array like this
[required_version] => Array 
( 
[0] => stdClass Object 
( 
[term_id] => 159 
[name] => 3.9 
[slug] => 3-9 
[term_group] => 0 
[term_taxonomy_id] => 230 
[taxonomy] => required_version 
[description] => 
[parent] => 0 
[count] => 17 
[filter] => raw 
) 
) 
[compatible_up_to] => Array 
( 
[0] => stdClass Object 
( 
[term_id] => 222 
[name] => 4.0 
[slug] => 4-0 
[term_group] => 0 
[term_taxonomy_id] => 283 
[taxonomy] => compatible_up_to 
[description] => 
[parent] => 0 
[count] => 4 
[filter] => raw 
) 
) 
We need to reconcile the target's taxonomies with the source's There will be a top level in the $taxonomies arrays for each registered taxonomy. In the event of a mismatch at this level we do nothing. The Compare function may help us find mismatches like this.
Source taxonomy Target taxonomy Processing
x – Ignore this source taxonomy
x x Process the terms in this taxonomy
– x Ignore this target taxonomy

Returns

void

Source

File name: oik-clone/admin/oik-clone-taxonomies.php
Lines:
1 to 18 of 18
function oik_clone_lazy_update_taxonomies( $post, $target ) {  
  $source_taxonomies = $post->post_taxonomies;
  $target_taxonomies = oik_clone_load_taxonomies( $target, $post->post_type );

  bw_trace2( $target_taxonomies, "target_taxonomies" );
  
  foreach ( $source_taxonomies as $source_taxonomy => $source_terms ) {
    $target_terms = bw_array_get( $target_taxonomies, $source_taxonomy, null ) ;
    bw_trace2( $target_terms, "target_terms", false );
    bw_trace2( $source_terms, "source_terms", false );
    if ( $target_terms !== null ) {
      oik_clone_lazy_update_taxonomy_terms( $target, (array) $source_terms, $target_terms );
    } else {
      p( "Source taxonomy missing from target: $source_taxonomy" );
  gobang();
    }
  } 
}
 
 View on GitHub

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

Information

Function name: oik_clone_lazy_update_taxonomies
Plugin ref: oik-clone – clone your WordPress content
Version: 2.1.1
Sourcefile: admin/oik-clone-taxonomies.php
File ref: admin/oik-clone-taxonomies.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
WordPress 6.0.1. PHP: 7.4.30. Memory limit: 768M