Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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