Skip to content

Instantly share code, notes, and snippets.

@kirasiris
Created February 3, 2018 09:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kirasiris/0e6335bc2ef819589e745912e0e30b1b to your computer and use it in GitHub Desktop.
Save kirasiris/0e6335bc2ef819589e745912e0e30b1b to your computer and use it in GitHub Desktop.
<?php
// Filtrar Posts por Author
function kuaf_filter_by_the_author() {
$params = array(
'name' => 'author', // Este es el atributo "name" para el <select>
'show_option_all' => 'All authors' // Label para todos los authores(muestra posts sin filtro)
);
if ( isset($_GET['user']) )
$params['selected'] = $_GET['user']; // Elije usuario seleccionado mediante la variable $_GET
wp_dropdown_users( $params ); // Print la lista de author preparada
}
add_action('restrict_manage_posts', 'kuaf_filter_by_the_author');
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment