WPML
SignaturePHP
add_filter( 'wpml_post_edit_screen_actions', 'the_callback_function' );

Description

  • Filters the post.php actions whose screen works in the language of the post it edits. By default, this is only edit, 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 adds elementor for the Elementor editor.
  • WPML reads the request language on plugins_loaded and again on wp_loaded. Add your callback before plugins_loaded runs, or on init. A callback added on init takes effect on the wp_loaded pass.

Arguments

One parameter is passed to this filter: actions.

  • $actionsstring[]

    The action values of post.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 the Editor of a Page BuilderPHP
add_filter( 'wpml_post_edit_screen_actions', function ( $actions ) {
	$actions[] = 'my_builder';

	return $actions;
} );