Search
 
SCRIPT & CODE EXAMPLE
 

PHP

woocommerce affiliate product link image to external link

add_action( 'template_redirect', 'redirect_external_products' );

function redirect_external_products() {
	global $post;

	if ( is_singular( 'product' ) && ! empty( $post ) && ( $product = wc_get_product( $post ) ) && $product->is_type( 'external' ) ) {
		wp_redirect( $product->get_product_url() );
		exit;
	}
}
Comment

PREVIOUS NEXT
Code Example
Php :: nl2br is not working for database in php 
Php :: how to check if a url has a certain word in laravel 
Php :: pg_relation_size in mb 
Php :: php pasar array por post 
Php :: how exactly works prompt parameter wp skipping password 
Php :: laravel list unique indexes 
Php :: Builder Pattern Method Chaining 2 
Php :: php isset tableau 
Php :: laravel orm latest() 
Php :: wordpress deny user to access wp-admin programmatically 
Php :: yoast seo alternative for laravel 
Php :: Convert backslash characters PHP 
Php :: carbon get difference between two dates in years and months 
Php :: php how to use multi byte functions 
Php :: next previous post link 
Php :: symfony retun json 
Php :: crypt (PHP 4, PHP 5, PHP 7, PHP 8) crypt — One-way string hashing 
Php :: send multiple attachment in mail laravel 8 
Php :: bin2hex (PHP 4, PHP 5, PHP 7, PHP 8) 
Php :: ussd php 
Php :: Number in English Words (Indian format) php 
Php :: verifier la version de php sur mon ordi 
Php :: obtener datos de orden wordpress php 
Php :: how to read laravel query string with dash 
Php :: php define() 
Php :: Comment supprimer les éléments liés à WordPress oEmbed 
Php :: Route::whereIn 
Php :: remove ul container from wp_nav_menu 
Php :: PHP how to skip file upload if file already exist 
Php :: laravel 8 crud api example 
ADD CONTENT
Topic
Content
Source link
Name
3+8 =