Filter: wp_most_popular_list_before

This filter is used to filter the opening html element of the outputted widget list. It can for example be used to change the output from a unordered list (ul) to a div.

Filter Parameters

  • $html (string) – The opening HTML element of the widget list

Example

Changing the widget output from a unordered list (ul) to a div.

<?php
/**
 * Replace the WP Most Popular widget's `ul` element with a `div`.
 * 
 * @param string $html The existing opening `ul`.
 * @return string
 */
function thenga_change_wp_most_popular_list_before( $html ) {
   $html = '<div>';
   return $html;
}
add_filter( 'wp_most_popular_list_before', 'thenga_change_wp_most_popular_list_before' );

Source

Found in system/widget.php

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.