We can test our website speed on website https://webpagetest.org.
If you are developer and what to test your website though coding then checkout below Webpagetest API example.
We send the Webpagetest API rest request to test the site.
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Hello World</title> | |
<style> | |
.card { | |
box-shadow: 0 4px 8px 0 rgba(0,0,0,0.2); | |
transition: 0.3s; | |
width: 50%; |
<?php | |
if ( ! function_exists( 'prefix_rank_math_excluded_post_types' ) ) : | |
function prefix_rank_math_excluded_post_types( $post_types = [] ) { | |
// Add the post types which you want to exclude. | |
$excludes = [ | |
'plgnoptmzr_work', | |
]; | |
return array_diff_key( $post_types, array_flip( $excludes ) ); |
<?php | |
if ( ! function_exists( 'prefix_analytics_gtag_config' ) ) : | |
/** | |
* Add/Modify Google tag manager variables | |
* | |
* @param array $args Google analytics arguments | |
*/ | |
function prefix_analytics_gtag_config( $args = [] ) { |
<?php | |
add_filter( 'http_request_args', 'prefix_http_request_args', 10, 2 ); | |
function prefix_http_request_args( $parsed_args, $url ) { | |
if ( false === strpos( $url, 'runPagespeed' ) ) { | |
return $parsed_args; | |
} | |
// Set timeout with 90 seconds. | |
$parsed_args['timeout'] = 90; |
<?php | |
if ( ! function_exists( 'prefix_remove_spaces' ) ) : | |
/** | |
* Remove spaces | |
* | |
* @param array $args Arguments. | |
* @return array | |
* | |
* @see https://wp.me/P4Ams0-9Sn |
<?php | |
if ( ! function_exists( 'prefix_copy_the_code_localize_vars' ) ) : | |
/** | |
* Localize vars. | |
* | |
* @return array | |
*/ | |
function prefix_copy_the_code_localize_vars( $args = array() ) { | |
// Redirect to page url. |
<?php | |
if ( ! function_exists( 'prefix_modify_mime_type' ) ) : | |
/** | |
* Modify the MIME types. | |
* | |
* @since x.x.x | |
* | |
* @param array $args File upload arguments. | |
* @return array. |
We can test our website speed on website https://webpagetest.org.
If you are developer and what to test your website though coding then checkout below Webpagetest API example.
We send the Webpagetest API rest request to test the site.
<?php | |
/** | |
* Change Button Text | |
* | |
* @todo Change the `prefix_` with your own unique string. | |
* | |
* @param string $button_text. | |
* @return string | |
*/ | |
function prefix_change_load_more_text( $button_text = '' ) { |
<?php | |
if( is_callable( 'Astra_Sites_Admin::get_instance' ) ) { | |
remove_action( 'admin_notices', array( Astra_Sites_Admin::get_instance(), 'admin_notices' ) ); | |
} |