Hi there is not better option, but to speed it up little you can use wordpress transient, see documentation: http://codex.wordpress.org/Transients_API
your code would look like this (and i cleaned it bit and used function empty to check array…):
<?php
if ( false === ( $tag_descrip = get_transient( 'tag_descrip' ) ) ) {
$tag_descrip = get_terms( 'product_tag', 'orderby=count&hide_empty=0' );
set_transient( 'tag_descrip ', $tag_descrip );
}
if ( !empty($tag_descrip) ){
foreach ( $tag_descrip as $tag_descrip ) {
if($tag_descrip->name == "parfum_bestof")
$title_new1 = $tag_descrip->description;
if($tag_descrip->name == "tshirt_bestof")
$title_new2 = $tag_descrip->description;
if($tag_descrip->name == "child_bestof")
$title_new3 = $tag_descrip->description;
}
}
?>
Related Posts:
- User registration followed by automatic login
- wp_insert_user role not working
- How to find cause of PHP notices with no stack trace?
- How to paginate a list of custom taxonomy terms?
- reason of splitting theme files to multiple files
- Limit the Excerpt field in WP-Admin in words
- wordpress separate registration for different roles
- How to get user by display_name with WP_User_Query
- Changing Link Attributes for Wp_Link_Pages
- Problem with Woocommerce REST API Authentication
- How to get custom image size for image uploaded in Customizer
- Passing POST data from one WP post to another
- How to change / delete product short description in Woocommerce
- How do I add HTML to a PHP function [closed]
- register_activation_hook isn’t adding table to DB
- how to get the value of time left for a transient
- Remove query string specific key value
- is_page “range” for if statement?
- How to Fetch values from WP database based on selected option value by onchange using PHP?
- wp_insert_post() is returning the correct post ID, no failure, but the post content does not get updated
- How to create a custom category of wordpress admin
- WordPress automatically adding html tag around PHP code
- WordPress child theme fails to override parent navigation menu in /inc/structure/header.php
- Customizer: Output default value in Customizer CSS
- Converting HTML Template to WordPress Theme
- adding custom user input fields in WordPress admin dashboard gives error The link you followed has expired. Please try again
- How to call plugin function per site in a multisite?
- How to remove ?wp-mce-4103-20162941
- How to Internationalize WordPress – Extract strings with textdomains, per textdomain individually
- How to make own crop image function for WordPress plugin
- Auto 301 to full post permalink? (using : /archive/%post_id% to %post_name% )
- need help with existing code showing subpages
- Using the_excerpt() on a page
- Showing latest post without 301 redirect
- Display custom field on 404 page outside loop
- get_total () returns 0 – woocommerce [closed]
- Pagination broken on is_front_page()
- php include not working in custom page
- Why doesn’t PhotoSmash plugin play well with wp_query?
- Building a REST API for your web app exposes primary keys of DB records?
- $_SESSION variables work perfectly on my local machine but returns NULL on development webserver
- Integrating Yii2 and WordPress
- PHP E_WARNING being shown despite php.ini [closed]
- Creating black and white copy of an image [closed]
- PHP code inside Shortcode
- After disabling WPML multi currency, the currency is still handled by the WPML
- preg_replace on all HTML content in WordPress
- Post class only applying to first excerpt; why?
- Add categorys to custom post type not working
- call adminbar greeting in other place
- PHP Warning: preg_match() expects & PHP Warning: strip_tags()
- Limit the number of child pages
- WP_LINK_PAGES Generating Unnecessary Tag
- Why is home page content not displaying with this rewrite rule?
- How to show upcoming events according to start date field
- Some problems in custom widget
- Call a function in functions.php from within tags (JS)
- Displaying images outside the content
- WordPress Conditional / Multiple Taxonomy Query
- Add class to ul and li in wp_na
- Can I ‘order by’ date that is in a text field?
- Show related products by attribute based and certain conditions
- How to retrieve taxonomy Metabox fields in frontend
- PHP function for horizontal Woocommerce thumbnails and badges
- Creating a Function and Call It
- How to count active users on a specific page
- WooCommerce display price before add to cart [closed]
- Adding column to wpex_users
- Create dashboard widget for custom theme support
- The style.php file inside theme-engine folder has other content on FTP
- WordPress ajax filter returning all posts when it should be filtering by category
- WooCommerce Quantity in Dropdown menu instead of clasic [closed]
- Trying To Call a Dynamic Email Address
- How to override html codes in wordpress?
- Insert data from form to database
- My search results are only showing 5 posts?
- WP_query meta_query slow with OR and DATES
- Plugin Modification Change Functionality For Logged User Only
- How can I output the slug of a comment author?
- redirect 301 with special character like WIX site “#!”
- customizer live preview layout picker
- Display tab title as ‘blog tagline | blog title’
- Conditional statement within WP SQL query
- Modify category archive page loop on functions.php
- How to display html code on homepage
- two wordpress sites, two themes, one database, same content
- Check if values exists DB
- Trying to exclude posts from a category on the home page
- Php conditional help needed
- Adapting a php array to WordPress
- Different layout on search page depending on category post
- WordPress and magic quotes
- Dynamically pull the correct email address from a match
- How to quickly/easily make an analysis (reverse engineering) of WordPress?
- New to wordpress. Need Help with templates [closed]
- Issues trying to add a href statment with PHP into a PHP Echo Statement [closed]
- Help with if/else loop [closed]
- rest_cannot_create_user – Sorry, you are not allowed to create new users. CURL WORDPRESS REST API
- Execute function when I click button
- links Slick jS library using wp_enqueue_scripts not pulling