Skip to content

Instantly share code, notes, and snippets.

@billerickson
Created June 23, 2019 20:07
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 billerickson/54fcebe15c567bd7600864b3516391a2 to your computer and use it in GitHub Desktop.
Save billerickson/54fcebe15c567bd7600864b3516391a2 to your computer and use it in GitHub Desktop.
<?php
/**
* Display Posts - URL Query Parameters
*
*/
function be_dps_url_query_params( $args ) {
$approved_params = array( 'orderby', 'order' );
foreach( $approved_params as $param ) {
if( !empty( $_GET[ $param ] ) )
$args[ $param ] = esc_attr( $_GET[ $param ] );
}
return $args;
}
add_filter( 'display_posts_shortcode_args', 'be_dps_url_query_params' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment