Skip to content

Instantly share code, notes, and snippets.

@michaeluno
Created December 7, 2016 10:22
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 michaeluno/caef45d979d8d24d7c17c0aaf9515d62 to your computer and use it in GitHub Desktop.
Save michaeluno/caef45d979d8d24d7c17c0aaf9515d62 to your computer and use it in GitHub Desktop.
A WordPress plugin that modifies the `count` parameter value of the API request query string made by the Fetch Tweets plugin.
<?php
/**
* Plugin Name: Fetch Tweets - Modify Count
* Description: Modifies the `count` parameter value of the API request query string.
* Version: 0.0.1
*/
class FetchTweetsModifyCount {
public function __construct() {
add_filter( 'fetch_tweets_filter_api_request_uri', array( $this, 'replyToModifyRequestURI' ) );
}
public function replyToModifyRequestURI( $sURI ) {
$_aArguments = wp_parse_args( $sURI, array( 'count' => 100 ) );
if ( $_aArguments[ 'count' ] > 100 ) {
return $sURI;
}
$sURI = remove_query_arg( array( 'count' ), $sURI );
return add_query_arg(
array( 'count' => 100 ),
$sURI
);
}
}
new FetchTweetsModifyCount;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment