Filter
uncanny-automator
automator_wp_get_disabled_post_types
Filters which post types are disabled for the current import run, allowing customization of import capabilities.
add_filter( 'automator_wp_get_disabled_post_types', $callback, 10, 1 );
Description
Filters the list of post types disabled for WP All Import. Use this hook to programmatically exclude specific post types from being importable through WP All Import within Uncanny Automator. The filter receives an array of post type slugs.
Usage
add_filter( 'automator_wp_get_disabled_post_types', 'your_function_name', 10, 1 );
Parameters
-
$post_types(mixed) - This parameter contains an array of post types that are disabled for use with the Uncanny Automator plugin.
Return Value
The filtered value.
Examples
<?php
/**
* Example of how to use the automator_wp_get_disabled_post_types filter.
*
* This example adds the 'attachment' post type to the list of disabled post types
* in Uncanny Automator. This means that 'attachment' post types will not be
* available for selection within Uncanny Automator recipes.
*/
add_filter( 'automator_wp_get_disabled_post_types', function( $disabled_post_types ) {
// Ensure $disabled_post_types is an array before adding to it.
if ( ! is_array( $disabled_post_types ) ) {
$disabled_post_types = array();
}
// Add the 'attachment' post type to the list of disabled post types.
$disabled_post_types[] = 'attachment';
// Return the modified array of disabled post types.
return $disabled_post_types;
}, 10, 1 );
Placement
This code should be placed in the functions.php file of your active theme, a custom plugin, or using a code snippets plugin.
Source Code
src/integrations/wp-all-import/helpers/wp-all-import-helpers.php:138
src/integrations/wp/helpers/wp-helpers.php:824
uncanny-automator-pro/src/integrations/wp/helpers/wp-pro-helpers.php:896
public function get_disabled_post_types() {
$post_types = array(
'attachment',
'uo-action',
'uo-closure',
'uo-trigger',
'uo-recipe',
'customize_changeset',
'custom_css',
'wp_global_styles',
'wp_template',
'wp_template_part',
'wp_block',
'user_request',
'oembed_cache',
'revision',
'wp_navigation',
'nav_menu_item',
);
return apply_filters( 'automator_wp_get_disabled_post_types', $post_types );
}