wp_dropdown_roles() to replace option value = code

The wp_dropdown_roles() function internally uses get_editable_roles() to fetch the needed roles. It does nothing else than fetching the roles from the global: $all_roles = $GLOBALS[‘wp_roles’]->roles; and filter it afterwards: return apply_filters( ‘editable_roles’, $all_roles ); So you can simply add the following function to a plugin or your functions.php file of your theme: function wpse137935_filter_editable_roles( Array … Read more

Custom Plugin theme filter

The page_template is a filter, not an action. Specifically it’s filtering the file path of the template to be included. So really you shouldn’t be loading anything in that callback (it’s too early). Instead just return its file path. add_filter( ‘page_template’, ‘load_tq_templates’ ); function load_tq_templates( $template ) { if ( is_page( ‘transport-quote-1’ ) ) { … Read more