Documentation

Developer Documentation

This document lists all WordPress hooks (actions and filters) that start with “rosettapress” in the codebase.

rosettapress_clone_post_data

This action fires when cloning post data from one site to another. It allows you to modify the post data before it’s cloned.

/*
* Source Action
*/
do_action('rosettapress_clone_post_data', $post_data, $source_post, $source_content_id, $target_blog_id);

Usage

The following would apply to all post cloning operations:

add_action('rosettapress_clone_post_data', 'your_custom_clone_post_data_function', 10, 4);

function your_custom_clone_post_data_function($post_data, $source_post, $source_content_id, $target_blog_id)
{
   // Modify post data here
   return $post_data;
}

Parameters

  • $post_data (array) – The post data to be cloned
  • $source_post (WP_Post) – The source post object
  • $source_content_id (int) – The source post ID
  • $target_blog_id (int) – The target blog ID

Return

Modified post data array

Source Code

This action is located in src/Repositories/PostsRepository.php

rosettapress_clone_post_meta

This action fires when cloning post meta data from one site to another. It allows you to modify the post meta data before it’s cloned.

/*
* Source Action
*/
do_action('rosettapress_clone_post_meta', $post_meta, $source_content_id, $target_blog_id);

Usage

The following would apply to all post meta cloning operations:

add_action('rosettapress_clone_post_meta', 'your_custom_clone_post_meta_function', 10, 3);

function your_custom_clone_post_meta_function($post_meta, $source_content_id, $target_blog_id)
{
   // Modify post meta here
   return $post_meta;
}

Parameters

  • $post_meta (array) – The post meta data to be cloned
  • $source_content_id (int) – The source post ID
  • $target_blog_id (int) – The target blog ID

Return

Modified post meta array

Source Code

This action is located in src/Integrations/WPifyCustomFieldsIntegration.php

rosettapress_post_cloned

This action fires after a post has been successfully cloned to another site. It allows you to perform additional operations after the cloning process is complete.

/*
* Source Action
*/
do_action('rosettapress_post_cloned', $source_content_id, $target_blog_id, $target_post_id);

Usage

The following would apply to all post cloning operations:

add_action('rosettapress_post_cloned', 'your_custom_post_cloned_function', 10, 3);

function your_custom_post_cloned_function($source_content_id, $target_blog_id, $target_post_id)
{
   // Perform additional operations here
}

Parameters

  • $source_content_id (int) – The source post ID
  • $target_blog_id (int) – The target blog ID
  • $target_post_id (int) – The newly created post ID in target blog

Source Code

This action is located in src/Repositories/PostsRepository.php

rosettapress_translatable_taxonomies

This filter allows you to modify which taxonomies are translatable in the system.

/*
* Source Filter
*/
apply_filters('rosettapress_translatable_taxonomies', $taxonomies);

Usage

The following would add custom taxonomies to the translatable list:

add_filter('rosettapress_translatable_taxonomies', 'your_custom_taxonomies_function');

function your_custom_taxonomies_function($taxonomies)
{
   $taxonomies[] = 'your_custom_taxonomy';
   return $taxonomies;
}

Parameters

  • $taxonomies (array) – Array of taxonomy names

Return

Modified array of taxonomy names

Source Code

This filter is located in src/Repositories/TermsRepository.php

rosettapress_settings_post_types

This filter allows you to modify which post types are available in the RosettaPress settings.

/*
* Source Filter
*/
apply_filters('rosettapress_settings_post_types', $post_types);

Usage

The following would add custom post types to the settings list:

add_filter('rosettapress_settings_post_types', 'your_custom_post_types_function');

function your_custom_post_types_function($post_types)
{
   $post_types[] = 'your_custom_post_type';
   return $post_types;
}

Parameters

  • $post_types (array) – Array of post type names

Return

Modified array of post type names

Source Code

This filter is located in src/Integrations/WooCommerceIntegration.php

rosettapress_settings_post_type

This filter allows you to modify the settings for a specific post type in RosettaPress.

/*
* Source Filter
*/
apply_filters('rosettapress_settings_post_type', $settings, $post_type);

Usage

The following would modify settings for a specific post type:

add_filter('rosettapress_settings_post_type', 'your_custom_post_type_settings_function', 10, 2);

function your_custom_post_type_settings_function($settings, $post_type)
{
   if ($post_type === 'your_post_type') {
      $settings['custom_setting'] = 'value';
   }
   return $settings;
}

Parameters

  • $settings (array) – The current settings for the post type
  • $post_type (string) – The post type name

Return

Modified settings array

Source Code

This filter is located in src/Integrations/WooCommerceIntegration.php

rosettapress_product_field_value_to_sync

This filter allows you to modify product field values before they are synced between sites.

/*
* Source Filter
*/
apply_filters('rosettapress_product_field_value_to_sync', $value, $field_name, $product_id, $source_blog_id, $target_blog_id);

Usage

The following would modify product field values during sync:

add_filter('rosettapress_product_field_value_to_sync', 'your_custom_product_field_function', 10, 5);

function your_custom_product_field_function($value, $field_name, $product_id, $source_blog_id, $target_blog_id)
{
   if ($field_name === 'your_field') {
      // Modify the value
      $value = 'modified_value';
   }
   return $value;
}

Parameters

  • $value (mixed) – The current field value
  • $field_name (string) – The name of the field being synced
  • $product_id (int) – The product ID
  • $source_blog_id (int) – The source blog ID
  • $target_blog_id (int) – The target blog ID

Return

Modified field value

Source Code

This filter is located in src/Integrations/WooCommerceIntegration.php

rosettapress_term_meta_value_to_sync

This filter allows you to modify term meta values before they are synced between sites.

/*
* Source Filter
*/
apply_filters('rosettapress_term_meta_value_to_sync', $value, $meta_key, $term_id, $taxonomy, $source_blog_id, $target_blog_id);

Usage

The following would modify term meta values during sync:

add_filter('rosettapress_term_meta_value_to_sync', 'your_custom_term_meta_function', 10, 6);

function your_custom_term_meta_function($value, $meta_key, $term_id, $taxonomy, $source_blog_id, $target_blog_id)
{
   if ($meta_key === 'your_meta_key') {
      // Modify the value
      $value = 'modified_value';
   }
   return $value;
}

Parameters

  • $value (mixed) – The current meta value
  • $meta_key (string) – The meta key being synced
  • $term_id (int) – The term ID
  • $taxonomy (string) – The taxonomy name
  • $source_blog_id (int) – The source blog ID
  • $target_blog_id (int) – The target blog ID

Return

Modified meta value

Source Code

This filter is located in src/Integrations/WooCommerceIntegration.php

wpifycf_wp_type_rosettapress_sites_groups

This filter determines the field type for RosettaPress sites groups in WPify Custom Fields.

/*
* Source Filter
*/
apply_filters('wpifycf_wp_type_rosettapress_sites_groups');

Usage

The following would set the field type for sites groups:

add_filter('wpifycf_wp_type_rosettapress_sites_groups', 'your_custom_field_type_function');

function your_custom_field_type_function()
{
   return 'array';
}

Return

String indicating the field type (‘array’)

Source Code

This filter is located in src/Integrations/WPifyCustomFieldsIntegration.php