Actions and filter defined in the feed2post-ircf module
feed2post_after_import
Type : action
Description : Custom hook defined in the plugin. Allows to expend or change a specific behavior.
Expected settings : $feed
How to use it :
add_action('feed2post_after_import', function($feed) {
// your logic right here
});
feed2post_after_post_update
Type : action
Description : Custom hook defined in the plugin. Allows to expend or change a specific behavior.
Expected settings : $post_id, $post, $result
How to use it :
add_action('feed2post_after_post_update', function($post_id, $post, $result) {
// your logic right here
});
feed2post_before_import
Type : action
Description :Custom hook defined in the plugin. Allows to expend or change a specific behavior.
Expected settings : $feed
How to use it :
add_action('feed2post_before_import', function($feed) {
// your logic right here
});
feed2post_before_media_update
Type : filter
Description : Custom hook defined in the plugin. Allows to expend or change a specific behavior.
Expected settings : $media, $post_id
How to use it :
add_filter('feed2post_before_media_update', function($media, $post_id) {
// your logic right here
return $media;
});
feed2post_before_post_delete
Type : action
Description : Custom hook defined in the plugin. Allows to expend or change a specific behavior.
Expected settings : $post_id
How to use it :
add_action('feed2post_before_post_delete', function($post_id) {
// your logic right here
});
feed2post_before_post_update
Type : filter
Description : Custom hook defined in the plugin. Allows to expend or change a specific behavior.
Expected settings : $post, $result
How to use it :
add_filter('feed2post_before_post_update', function($post, $result) {
// your logic right here
return $post;
});
feed2post_before_user_update
Type : filter
Description : Custom hook defined in the plugin. Allows to expend or change a specific behavior.
Expected settings : $user, $result
How to use it :
add_filter('feed2post_before_user_update', function($user, $result) {
// your logic right here
return $user;
});
feed2post_csv_encode_string
Type : filter
Description : Custom hook defined in the plugin. Allows to expend or change a specific behavior.
Expected settings : $result, $string
How to use it :
add_filter('feed2post_csv_encode_string', function($result, $string) {
// your logic right here
return $result;
});
feed2post_csv_parse_separator
Type : filter
Description :Custom hook defined in the plugin. Allows to expend or change a specific behavior.
Expected settings : $result, $separator
How to use it :
add_filter('feed2post_csv_parse_separator', function($result, $separator) {
// your logic right here
return $result;
});
feed2post_default_options
Type : filter
Description : Allow to modify the default options of the feed2post module, like the debug mode or the feeds behavior.
Expected settings : $options
How to use it :
add_filter('feed2post_default_options', function($options) {
$options['debug_mode_enabled'] = true;
return $options;
});
feed2post_feed_fields_mapping
Type : filter
Description : Custom hook defined in the plugin. Allows to expend or change a specific behavior.
Expected settings : $result
How to use it :
add_filter('feed2post_feed_fields_mapping', function($result) {
// your logic right here
return $result;
});
feed2post_feed_fields_templates
Type : filter
Description : Custom hook defined in the plugin. Allows to expend or change a specific behavior.
Expected settings : $result
How to use it :
add_filter('feed2post_feed_fields_templates', function($result) {
// your logic right here
return $result;
});
feed2post_feed_filters_conditions
Type : filter
Description : Custom hook defined in the plugin. Allows to expend or change a specific behavior.
Expected settings : $result
How to use it :
add_filter('feed2post_feed_filters_conditions', function($result) {
// your logic right here
return $result;
});
feed2post_feed_types
Type : filter
Description : Custom hook defined in the plugin. Allows to expend or change a specific behavior.
Expected settings : $result
How to use it :
add_filter('feed2post_feed_types', function($result) {
// your logic right here
return $result;
});
feed2post_field_options
Type : filter
Description : Custom hook defined in the plugin. Allows to expend or change a specific behavior.
Expected settings : $result, $name
How to use it :
add_filter('feed2post_field_options', function($result, $name) {
// your logic right here
return $result;
});
feed2post_filename
Type : filter
Description : Allow to custom the name of the file used to temporarily stock a saved RSS feed.
Expected settings : $name, $url, $tmp_file
How to use it :
add_filter('feed2post_filename', function($name, $url, $tmp_file) {
return 'flux_personnalise_' . md5($url) . '.xml';
}, 10, 3);
feed2post_get_archive_row
Type : filter
Description : Custom hook defined in the plugin. Allows to expend or change a specific behavior.
Expected settings : $row, $line, $this
How to use it :
add_filter('feed2post_get_archive_row', function ($row, $line, $feed){
if ($feed->get_post_type() != 'nomduflux') return $row;
// Add a default value for the taxonomy mataxo = Other
if (!isset($row['mataxo']) || empty($row['mataxo'])){
$row['mataxo'] = 'Other';
}
// Ignore rows whose date of publication is prior to 6 months
if (empty($row['published_on']) || strtotime($row['published_on']) < strtotime('6 months ago')){
return null;
}
return $row;
}, 10, 3);
feed2post_get_field_options
Type : filter
Description : Custom hook defined in the plugin. Allows to expend or change a specific behavior.
Expected settings : $result, $name, $this
How to use it :
add_filter('feed2post_get_field_options', function($arg1, $arg2 = null) {
// your logic right here
return $arg1;
});
feed2post_get_field_value
Type : filter
Description : Custom hook defined in the plugin. Allows to expend or change a specific behavior.
Expected settings : $value, $name, $result, $single, $this
How to use it :
add_filter('feed2post_get_field_value', function ($value, $name, $result, $single, $feed) {
if ($feed->get_post_type() != 'nomduflux') return $value;
// Replace a user name by its ID
if ($name == 'user_name'){
$user = get_user_by('login', $value);
$value = isset($user) ? $user->ID : 0;
}
// Define a default value
if ($name == 'salary' && empty($value)){
$value = 'N/A';
}
// Concatenate 2 fields in a single one
if ($name == 'lat' || $name == 'lng'){
$value = $result['lat'] . ',' . $result['lng'];
}
// Format a field text in HTML ( see function custom_text_to_html below)
if ($name == 'description' || $name == 'requirements'){
$value = custom_text_to_html($value);
}
return $value;
}, 10, 5);
function custom_text_to_html($text){
$text = preg_replace("/\r\n|\r|\n/", "\n", $text);
$text = str_replace("\n", "<br>", $text);
return $text;
}
feed2post_get_meta
Type : filter
Description : Custom hook defined in the plugin. Allows to expend or change a specific behavior.
Expected settings : $value, $name, $feed
How to use it :
add_filter('feed2post_get_meta', function($value, $name, $feed) {
// your logic right here
return $value;
});
feed2post_get_option
Type : filter
Description : Custom hook defined in the plugin. Allows to expend or change a specific behavior.
Expected settings : $value, $name, $feed
How to use it :
add_filter('feed2post_get_option', function($value, $name, $feed) {
// your logic right here
return $value;
});
feed2post_logger
Type : filter
Description : Custom hook defined in the plugin. Allows to expend or change a specific behavior.
Expected settings : $feed2post_logger
How to use it :
add_filter('feed2post_logger', function($feed2post_logger) {
// your logic right here
return $feed2post_logger;
});
feed2post_openai_models
Type : filter
Description : Custom hook defined in the plugin. Allows to expend or change a specific behavior.
Expected settings : $models
How to use it :
add_filter('feed2post_openai_models', function($models) {
// your logic right here
return $models;
});
feed2post_openai_prompt
Type : filter
Description : Custom hook defined in the plugin. Allows to expend or change a specific behavior.
Expected settings : $result, $feed
How to use it :
add_filter('feed2post_openai_prompt', function($result, $feed) {
// your logic right here
return $result;
}, 10, 2);
feed2post_options_fields
Type : filter
Description : Custom hook defined in the plugin. Allows to expend or change a specific behavior.
Expected settings : $result
How to use it :
add_filter('feed2post_options_fields', function($result) {
// your logic right here
return $result;
});
feed2post_options_meta_box_after_field
Type : filter
Description : Custom hook defined in the plugin. Allows to expend or change a specific behavior.
How to use it :
add_filter('feed2post_options_meta_box_after_field', function($arg1) {
// your logic right here
return $arg1;
});
feed2post_options_meta_box_before_field
Type : filter
Description : Custom hook defined in the plugin. Allows to expend or change a specific behavior.
How to use it :
add_filter('feed2post_options_meta_box_before_field', function($arg1) {
// your logic right here
return $arg1;
});
feed2post_options_meta_box_field
Type : filter
Description : Custom hook defined in the plugin. Allows to expend or change a specific behavior.
Expected settings : $field_html, $field, $name, $feed
How to use it :
add_filter('feed2post_options_meta_box_field', function($field_html, $field, $name, $feed) {
// your logic right here
return $field_html;
}, 10, 4);
feed2post_parse_query
Type : filter
Description : Custom hook defined in the plugin. Allows to expend or change a specific behavior.
Expected settings : $wp_query
How to use it :
add_filter('feed2post_parse_query', function($wp_query) {
// your logic right here
return $wp_query;
});
feed2post_post_field_template_
Type : filter
Description : Allow to filter a field value according to a template defined for a feed. The name of the hook is dynamically suffixed.
How to use it :
add_filter('feed2post_post_field_template_custom', function($value, $field, $item, $feed) {
return str_replace('{title}', $item->get_title(), $field['template']);
}, 10, 4);
feed2post_post_field_value
Type : filter
Description : Allow to filter a field value before being added into a WordPress post.
Expected settings : $value, $field
How to use it :
add_filter('feed2post_post_field_value', function($value, $field) {
if ($field['key'] === 'title') {
return strtoupper($value);
}
return $value;
}, 10, 2);
feed2post_post_field_value_
Type : filter
Description : Allow to filter a field value according to a custom mapping (mapping). The hook’s name is dynamically sufixed.
How to use it :
add_filter('feed2post_post_field_value_my_mapping', function($value, $field) {
return 'Préfixe : ' . $value;
}, 10, 2);
feed2post_searchform_field_controls
Type : filter
Description : Custom hook defined in the plugin. Allows to expend or change a specific behavior.
Expected settings : $result, $opts
How to use it :
add_filter('feed2post_searchform_field_controls', function($result, $opts) {
// your logic right here
return $result;
}, 10, 2);
feed2post_sirtaqui_soap_call
Type : filter
Description : Custom hook defined in the plugin. Allows to expend or change a specific behavior.
Expected settings : $result, $method, $params
How to use it :
add_filter('feed2post_sirtaqui_soap_call', function($result, $method, $params) {
// your logic right here
return $result;
});