Skip to content

Instantly share code, notes, and snippets.

@wp-user-manager
Last active June 5, 2020 12:35
Show Gist options
  • Save wp-user-manager/57b18f07263f4a32e6df97c7bd4041d0 to your computer and use it in GitHub Desktop.
Save wp-user-manager/57b18f07263f4a32e6df97c7bd4041d0 to your computer and use it in GitHub Desktop.
WP User Manager - Register a directory for templates in plugins or other code
<?php
/**
* @param array $file_paths
*
* @return array
*/
function my_wpum_register_template_location( $file_paths ) {
$path = trailingslashit( dirname( __FILE__ ) . 'templates' );
// Add template path first as a higher priority to the core plugin and theme
array_unshift( $file_paths, $path );
return $file_paths;
}
add_filter( 'wpum_template_paths', 'my_wpum_register_template_location' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment