-
-
Save billerickson/54fcebe15c567bd7600864b3516391a2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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