add_filter( 'wpml_post_edit_screen_actions', 'the_callback_function' );
Description
- Filters the
post.phpactions whose screen works in the language of the post it edits. By default, this is onlyedit, the WordPress editor. - On these screens, WPML takes the language of the edited post, not the admin language switcher. The REST and admin-ajax requests that the screen sends use the same language.
- Use it when your page builder opens its editor with its own action, for example
post.php?post=N&action=my_builder. Without it, your editor works in the language selected in the admin bar. WPML Page Builders already addselementorfor the Elementor editor. - WPML reads the request language on
plugins_loadedand again onwp_loaded. Add your callback beforeplugins_loadedruns, or oninit. A callback added oninittakes effect on thewp_loadedpass.
Arguments
One parameter is passed to this filter: actions.
$actionsstring[]Theactionvalues ofpost.php?post=N&action=<action>that open a screen to edit the post. Default:[ 'edit' ], the WordPress editor. Return the array with your editor’s action added.
WPML removes trash, untrash and delete from the returned array. These actions never change the working language. If the filter returns something that is not an array, WPML uses the default.
Example Usage
Your page builder opens its editor at post.php?post=N&action=my_builder. Add my_builder to the actions.
add_filter( 'wpml_post_edit_screen_actions', function ( $actions ) { $actions[] = 'my_builder'; return $actions; } );