SignaturePHP
add_filter( 'wpml_ls_directories_to_scan', 'the_callback_function' );
Description
- This hook is useful when developers want to add their own directories instead of the default directory
{your-theme-folder}/wpml/templates/language-switchers/. - WPML also loads a template’s
template.phpfrom the folders you add here. It never loads a PHP template from the uploads folder, even when you add that folder with this filter. - From WPML 5.3, WPML also checks where a template file really is: a template folder that is a symbolic link to a place outside these folders, or into the uploads folder, is not used. A theme folder that is itself a symbolic link works.
- See more at the Custom language switcher templates document.
Arguments
There is only one parameter passed to this filter: dirs.
$dirsarrayThe array including directories.
Example Usage
PHP
function wpmlhook_ls_dirs_to_scan( $dirs ) { $dirs[] = __DIR__ . '/templates/'; return $dirs; } add_filter( 'wpml_ls_directories_to_scan', 'wpmlhook_ls_dirs_to_scan' );