list_cats & get_pages modded for multiple calls, questioning impact
-
Hi all.
I modified both list_cats & get_pages (called by wp_list_cats and wp_list_pages, respectively) so that they can be called more than one time successfully. I’m questioning the impact of my mod since I’m new to WordPress, and others out there with more intimate knowledge of the WordPress source code might have some insight to the impact of this modification.
In the function list_cats, the line
if (!count($category_posts)) {
prevents 2nd and subsequent calls to wp_list_cats from retrieving the categories.Similarly, in the function get_pages, the line
if (!isset($cache_pages) || empty($cache_pages)) {
prevents 2nd and subsequent calls to wp_list_pages from retrieve the pages.As both lines of code obviously show, if the objects already contain categories or pages, the following lines should not execute. It is those following lines that obtain the categories or pages.
While I’ve tested the modifications, I’m sure there’s a reason for putting those lines of code to prevent retrieval during subsequent calls – the question is why and what’s the impact of removing the code?
-rsramirez
- The topic ‘list_cats & get_pages modded for multiple calls, questioning impact’ is closed to new replies.