wp_list_categories Issue
-
I wonder if anyone could shed some light for me. I have updated wordpress and one of my plugins has stopped working, which is also up to date. I have narrowed it down to exactly what isnt working the following :-
<li class="cat-item cat-item-49"> <a href="/category/industries/energy/">Energy</a> </li>
Should look like :-
<li class="cat-item cat-item-49"> <a class="data-post-taxonomy-category" data-post-taxonomy="category" href="/category/industries/energy/"> </li>
This whole plugin works on using the class and data attribute so without these none of the JS is working either. However as it is only WP that has updated I assume something has changed in the wp_list_categories function? It is the following line of code that does changes the category links to contain the correct data :-
$args = array( 'taxonomy' => $filter, 'orderby' => 'name', 'show_count' => $this->get_option('show_count'), 'pad_counts' => 0, 'hierarchical' => 1, 'title_li' => '', 'hide_empty' => 0, 'echo' => 0 ); $content = wp_list_categories( $args ); $content = preg_replace('|<a href="(.+?)">(.+?)</a>|i', '<a href="$1" data-post-taxonomy="'.$filter.'" class="data-post-taxonomy-'.$filter.'"><i class="icon-check-empty"></i> $2</a>', $content); return $content;
Is there any reason why the preg_replace would stop working in the plugin code on a WP upgrade? Still working fine on the old version.
Any information would be greatly appreciated.
Thanks in advance J
- The topic ‘wp_list_categories Issue’ is closed to new replies.