Hooks & Filters
WordPress actions and filters — vote lifecycle, templates, backup, settings panel, and Pro extensions.
WP ULike is built for extension. Use hooks in Settings → Developer Tools → PHP Snippets, a child theme, or a custom plugin.
This reference covers the most-used hooks. Filter names follow WordPress conventions — search the codebase for apply_filters('wp_ulike and do_action('wp_ulike for the full list.
Vote lifecycle (execution order)
wp_ulike_before_process
→ permission checks (wp_ulike_permission_status)
→ DB insert/update
→ wp_ulike_data_inserted | wp_ulike_data_updated
→ wp_ulike_after_process
→ wp_ulike_ajax_respond (AJAX only)
wp_ulike_before_process
Action · 1 arg: $data array
add_action('wp_ulike_before_process', function($data) {
// $data: id, type, nonce, template, factor, client_address, displayLikers, …
}, 10, 1);
Filter incoming AJAX data first: wp_ulike_listener_data.
wp_ulike_after_process
Action · 1 arg: $args array (not positional scalars)
add_action('wp_ulike_after_process', function($args) {
// Keys: id, key, user_id, status, has_log, slug, table, is_distinct
if ($args['status'] === 'like') { /* … */ }
}, 10, 1);
Data hooks
add_action('wp_ulike_data_inserted', function($args) { /* new vote */ });
add_action('wp_ulike_data_updated', function($args) { /* status change */ });
add_action('wp_ulike_delete_vote_data', function($ID, $type, $settings) {
/* maintenance / GDPR deletion */
}, 10, 3);
Template actions
add_action('wp_ulike_before_template', function($args) { /* before wrapper */ }, 10, 1);
add_action('wp_ulike_inside_like_button', function($args) { /* inside like btn */ }, 10, 1);
add_action('wp_ulike_after_up_vote_button', function($args) { /* after like btn */ }, 10, 1);
add_action('wp_ulike_inside_dislike_button', function($args) { /* [pro] */ }, 10, 1);
add_action('wp_ulike_after_down_vote_button', function($args) { /* [pro] */ }, 10, 1);
add_action('wp_ulike_inside_template', function($args) { /* inside wrapper */ }, 10, 1);
add_action('wp_ulike_after_template', function($args) { /* after wrapper */ }, 10, 1);
Template & display filters
| Filter | Args | Purpose |
|---|---|---|
wp_ulike_add_templates_list | $templates | Register custom templates |
wp_ulike_add_templates_args | $args, $template | Modify render args |
wp_ulike_return_final_templates | $html, $args | Final HTML output |
wp_ulike_count_box_template | $html, $counter | Counter markup |
wp_ulike_button_text | $text, $status, $setting_key | Button labels |
wp_ulike_login_alert_template | $html, $args | Login required HTML |
wp_ulike_custom_css | $css | Append generated CSS |
wp_ulike_the_content | $content, $button | Post content + button |
wp_ulike_comment_text | $text, $button | Comment text + button |
wp_ulike_format_number | $formatted, $number, $status | K/M/B formatting |
wp_ulike_likers_box_shortcode | $output, $args | Likers shortcode HTML |
wp_ulike_get_likers_list | $list, $args | Likers list HTML |
wp_ulike_get_likers_template | $template, $args | Likers template HTML |
wp_ulike_inline_display_likers_box | $display, $type | Inline likers toggle |
wp_ulike_rating_value | $value, $post_id | Rating percentage |
Permission & AJAX
add_filter('wp_ulike_permission_status', function($allowed, $args, $settings) {
return false; // block vote
}, 10, 3);
add_filter('wp_ulike_user_current_status', function($status, $prev, $args) {
return $status;
}, 10, 3);
add_filter('wp_ulike_ajax_respond', function($response, $item_id, $status, $atts) {
$response['custom'] = 'value';
return $response;
}, 10, 4);
add_filter('wp_ulike_counter_value', function($value, $ID, $type, $status, $date_range) {
return $value;
}, 10, 5);
add_filter('wp_ulike_ajax_counter_value', function($val, $item_id, $item_type, $status, $is_distinct, $template) {
return $val;
}, 10, 6);
Status response filters: wp_ulike_respond_for_liked_data, wp_ulike_respond_for_unliked_data, wp_ulike_respond_for_not_liked_data, wp_ulike_respond_for_no_limit_data.
Process filters: wp_ulike_ajax_process_atts, wp_ulike_user_prev_status, wp_ulike_validate_blacklist.
Auto-display & integration
add_filter('wp_ulike_enable_auto_display', function($enabled, $type) {
return $enabled;
}, 10, 2);
add_filter('wp_ulike_auto_diplay_filter_list', function($conditions) {
$conditions['is_custom'] = is_page('special');
return $conditions;
});
add_filter('wp_ulike_get_the_id', function($post_id) {
return $post_id; // WPML / Polylang
});
add_filter('wp_ulike_get_user_ip', function($ip) {
return $ip;
});
Content-type attribute filters: wp_ulike_posts_add_attr, wp_ulike_comments_add_attr, wp_ulike_activities_add_attr, wp_ulike_topics_add_attr.
Query filters: wp_ulike_get_top_posts_query, wp_ulike_get_top_comments_query, wp_ulike_supported_post_types_for_top_posts_list, wp_ulike_period_limit_sql.
BuddyPress
add_filter('wp_ulike_post_bp_notification_args', function($args) { return $args; });
add_filter('wp_ulike_comment_bp_notification_args', function($args) { return $args; });
add_filter('wp_ulike_bp_add_notification_args', function($args) { return $args; });
add_filter('wp_ulike_bp_notifications_template', function($content, $link, $total, $item_id) {
return $content;
}, 10, 4);
Settings panel filters
Inject fields into the Optiwich settings UI:
| Filter | Section |
|---|---|
wp_ulike_panel_general | General |
wp_ulike_panel_content_options | Shared content options |
wp_ulike_panel_post_type_options | Posts tab |
wp_ulike_panel_comment_type_options | Comments tab |
wp_ulike_panel_buddypress_type_options | BuddyPress tab |
wp_ulike_panel_bbpress_type_options | bbPress tab |
wp_ulike_panel_profiles | Profiles Pro |
wp_ulike_panel_forms | Login & Signup Pro |
wp_ulike_panel_social_logins | Social Logins Pro |
wp_ulike_panel_share_buttons | Share Buttons Pro |
wp_ulike_panel_emails | Email templates Pro |
wp_ulike_panel_translations | Strings |
wp_ulike_panel_customization | Developer scripts |
wp_ulike_panel_integrations | Integrations |
wp_ulike_filter_counter_options | Counter prefix/suffix fields |
Schema API: wp_ulike_optiwich_schema, wp_ulike_optiwich_pages, wp_ulike_optiwich_values, wp_ulike_optiwich_save_values.
Customizer API: wp_ulike_optiwich_customizer_schema, wp_ulike_optiwich_customizer_values, wp_ulike_customizer_sections, wp_ulike_customizer_button_group_options.
Lifecycle: wp_ulike_settings_saved, wp_ulike_customizer_saved, wp_ulike_loaded, wp_ulike_activated, wp_ulike_deactivated.
Backup & import hooks
| Hook | Type | Purpose |
|---|---|---|
wp_ulike_backup_export_payload | filter | Add data to export JSON |
wp_ulike_backup_import_extensions | filter | Restore extension data; return WP_Error to abort |
wp_ulike_backup_imported | action | After successful import |
wp_ulike_backup_intro | filter | Help page backup card text |
wp_ulike_backup_import_confirm | filter | JS confirm message on import |
Pro uses wp_ulike_backup_export_payload for Display Automation rules and REST API settings. See Backup and Restore.
Meta data hooks (dynamic)
Replace {meta_group} with post, comment, activity, topic, user, or statistics:
Actions: wp_ulike_add_{group}_meta, wp_ulike_added_{group}_meta, wp_ulike_update_{group}_meta, wp_ulike_updated_{group}_meta, wp_ulike_delete_{group}_meta, wp_ulike_deleted_{group}_meta
Filters: wp_ulike_add_{group}_metadata, wp_ulike_update_{group}_metadata, wp_ulike_delete_{group}_metadata, wp_ulike_default_{group}_metadata
Pro — Display Automation
add_filter('wp_ulike_pro_display_automation_matches', function($match, $rule, $conditions, $context) {
return $match;
}, 10, 4);
add_filter('wp_ulike_pro_display_automation_content_types', function($types, $group) {
return $types;
}, 10, 2);
add_filter('wp_ulike_pro_display_automation_quick_start_presets', function($presets) {
return $presets;
});
add_filter('wp_ulike_pro_display_automation_placements', function($placements, $group) {
return $placements;
}, 10, 2);
add_filter('wp_ulike_pro_display_automation_button_args', function($args, $rule) {
return $args;
}, 10, 2);
Pro — Profiles, forms, social
Profile actions: wp_ulike_pro_profile_before_hook, wp_ulike_pro_profile_after_hook, wp_ulike_pro_profile_after_avatar, wp_ulike_pro_profile_before_tabs
Form actions: wp_ulike_pro_forms_before_hook, wp_ulike_pro_forms_after_hook, wp_ulike_pro_before_login_process, wp_ulike_pro_after_login_process
Social login: wp_ulike_pro_social_login_hybridauth_config, wp_ulike_pro_social_login_allowed_social_providers, wp_ulike_pro_social_login_user_account_linked
Share: wp_ulike_pro_share_buttons_before, wp_ulike_pro_share_buttons_after
Email: wp_ulike_pro_mail_extra_vars, wp_ulike_pro_before_email_template_body, wp_ulike_pro_email_send_subject
Schema: wp_ulike_pro_generate_schema_properties
REST: wp_ulike_pro_rest_api_routes
Elementor: wp_ulike_pro/elementor/widgets_list, wp_ulike_pro/elementor_widget/before_render
License: wp_ulike_pro_license_api_url, wp_ulike_pro_on_license_action
Lifecycle: wp_ulike_pro_loaded, wp_ulike_pro_activated, wp_ulike_pro_deactivated
Admin hooks
| Hook | Purpose |
|---|---|
wp_ulike_admin_pages | Register admin submenus |
wp_ulike_manage_posts_columns | Post list columns |
wp_ulike_menu_badge_count | Admin menu vote badge |
wp_ulike_about_pro_upsell | Help page Pro card content |
wp_ulike_stats_data_limit | Statistics query limits |
Top List block: wp_ulike_top_content_block_items, wp_ulike_top_content_block_attributes, wp_ulike_top_content_popular_query_args.
Also see: JavaScript Events · Front-End AJAX
Related articles
Continue with these guides
Did this article help?
Pick how you feel, add a note if you want, then hit Send. It takes two seconds and helps us improve this guide.