This repository has been archived by the owner on Nov 4, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 9
Filters
Jesper Bjerke edited this page Nov 6, 2015
·
13 revisions
-
compile_options modify the partially compiled options array, called multiple times, (3 arguments),
$compiled_options
,$default_options
,$new_options
- wa_fronted_options modify options array, use this to set your options (1 argument)
- wa_fronted_settings_fields modify default settings fields to render into form (1 argument), array of field keys
-
wa_fronted_settings_values modify values before they're sent to the
wp_update_post
function array, use this to set your options (1 argument) - supported_acf_fields modify supported ACF fields array (1 argument)
- supported_woo_fields modify supported WooCommerce fields/values array (1 argument)
- supported_custom_fields modify supported native custom field types (1 argument)
-
wa_fronted_revisions modify the returned array of revisions (2 arguments),
$revisions
,$post_id
-
wa_fronted_autosave_data modify the data before it creates an autosave revision (2 arguments),
$autosave_data
,$data
-
wa_fronted_get_autosave modify the data before it returns autosaved revision (1 argument),
$autosave_data
-
wa_get_js_i18n modify the array of translateable strings sent to javascript (1 argument),
$translations
The javascript filters functions very similarly to their native PHP counterparts. Only difference is that these functions resides within the
wa_fronted
object, so to call theadd_filter
function, you type like so:wa_fronted.add_filter('filter_name', function(value){ return value; });
- toolbar_buttons modify the buttons available to the editor toolbar (2 arguments), passes an array of strings as the first argument (which should be returned) and current editor options as second
- editor_plugins modify plugins loaded in TinyMCE (2 arguments), passes an object with active extensions as the first argument (which should be returned), and current editor options as second.
-
validate add a custom validation method. Should only return true or false (4 arguments),
bool
(result),value to validate
,validation method called
,comparison value
-
validation_msg add a custom validation error message (3 arguments),
message
,validation method
,comparison value
-
revision_content modify the contents of the revision field (3 arguments),
new_content
(revision contents),editor
(editor object + options),revision
(revision object),new_content
(revision contents) -
revision_db_value modify the database value of revision field (if necessary) (3 arguments),
new_content
(revision contents),editor
(editor object + options),revision
(revision object) -
image_upload_toolbar modify the array of button elements that is shown together with the image upload button (2 arguments),
buttons
,editor_options
-
image_edit_toolbar modify the array of button elements that is shown in the image edit toolbar (2 arguments),
buttons
,editor_options
-
shortcode_actions add your shortcode base to be called within
shortcode_action_{shortcode base}
instead of the regular shortcode edit input -
save_extra_data if you need to pass additional data through ajax upon save, use this filter, (3 arguments),
data_to_save
,content
(regular content to be saved),editor_options
-
autosave_extra_data if you need to pass additional data through ajax upon autosave, use this filter, (3 arguments),
data_to_save
,content
(regular content to be saved),editor_options
I'll try to add filters where I see it could be useful, but if you are missing one, please post an issue requesting it
Are you making an extension or is your theme configured to support Fronted? Post an issue and I'll add it here!