enter image description here

I have a category page as below:

and when a category is clicked, using the following code

$sql_categories = $wpdb->prepare ("SELECT * FROM ".$wpdb->prefix."wtd_art_categories WHERE Parent = %d ORDER BY Id", $_GET['c']);
$get_categories = $wpdb->get_results( $sql_categories );

it queries sub categories and then I display on the same page. (Example Shapes clicked):

Since each time there is a query, I thought this is causing the delay, and I used a session variable to keep the $wpdb->get_results , however still it is not fast as I expected.

What kind of trick can I use to increase speed of navigation inside these categories ?

Read more here: Performance optimization of tree like structure


If you know the solution of this issue, please leave us a reply in Comment section, to update the question.

Wordpress related questions and answers: