The install_popular_tags() WordPress PHP function retrieves popular WordPress plugin tags.
Usage
install_popular_tags( $args );
Custom example:
$args = array( 'number' => 10 ); $popular_tags = install_popular_tags( $args ); echo implode(', ', $popular_tags);
Output:
e-commerce, gallery, seo, social, widgets, forms, security, analytics, slider, cache
Parameters
$args
(array) – Optional. Default: array(). An array of arguments to filter the results.
More Information
See WordPress Developer Resources: install_popular_tags()
Examples
Retrieve the top 5 popular tags
Get the top 5 popular plugin tags and display them as a comma-separated list.
$args = array( 'number' => 5 ); $popular_tags = install_popular_tags( $args ); echo implode(', ', $popular_tags);
Display popular tags as an unordered list
Retrieve the popular plugin tags and display them as an unordered list in HTML.
$popular_tags = install_popular_tags(); echo '<ul>'; foreach ($popular_tags as $tag) { echo '<li>' . $tag . '</li>'; } echo '</ul>';
Retrieve popular tags with a custom API URL
Use a custom API URL to retrieve the popular tags.
$args = array( 'api_url' => 'https://custom-api-url.com' ); $popular_tags = install_popular_tags( $args ); echo implode(', ', $popular_tags);
Display popular tags as an ordered list with a custom number of tags
Retrieve a custom number of popular plugin tags and display them as an ordered list in HTML.
$args = array( 'number' => 7 ); $popular_tags = install_popular_tags( $args ); echo '<ol>'; foreach ($popular_tags as $tag) { echo '<li>' . $tag . '</li>'; } echo '</ol>';
Retrieve popular tags and display them in a dropdown
Retrieve the popular plugin tags and display them as a dropdown menu in HTML.
$popular_tags = install_popular_tags(); echo '<select>'; foreach ($popular_tags as $tag) { echo '<option value="' . $tag . '">' . $tag . '</option>'; } echo '</select>';