internetearnings.com

Remove AdSense in 404 Not Found Page in phpMyDirectory

Recently, I warned by Google AdSense team because AdSense displayed on 404 Not Found Page in phpMyDirectory website which they don’t allow. In their email, it clearly stated that AdSense must not be displayed on this page as shown below.

Violation explanation

In order to ensure a high quality user experience and appropriately targeted ads, Google ads may only be placed on original, information-rich content that’s easy for users to navigate.

Ads should not be the main focus of the page and/or be more prominent than the content itself. This may include pages that a user visits before potentially exiting a domain (i.e., “exit pages” or “thank you” pages), 404 error pages, and some log-in pages. As our ads are contextually targeted, image galleries with little text are also not the best place for our ads.

In order to comply, add the AdSense code as shown below where you want to insert the ads.

<?php if(http_response_code() != 404) { ?>
// AdSense Code
<?php } ?>

Remove the Billing Details from WooCommerce Checkout

By default, WooCommerce will add a form to the client to enter his billing details such as name, company, address, city postcode, state, phone & country. For some web store owner, you may not need of them, especially if you only sell digital or virtual products. We just need customers to make payment through PayPal in the simplest way possible.

Unfortunately, there are no settings in WooCommerce to disable these fields. The only way to do it is by editing theme’s “functions.php” file.

What you need to do is add the following codes in your theme’s “functions.php” file but remember to remove the line where you need details from your customers.

add_filter( 'woocommerce_checkout_fields' , 'custom_override_checkout_fields' );
 
function custom_override_checkout_fields( $fields ) {
    unset($fields['billing']['billing_first_name']);
    unset($fields['billing']['billing_last_name']);
    unset($fields['billing']['billing_company']);
    unset($fields['billing']['billing_email']);
    unset($fields['billing']['billing_address_1']);
    unset($fields['billing']['billing_address_2']);
    unset($fields['billing']['billing_city']);
    unset($fields['billing']['billing_postcode']);
    unset($fields['billing']['billing_country']);
    unset($fields['billing']['billing_state']);
    unset($fields['billing']['billing_phone']);
    unset($fields['order']['order_comments']);
    return $fields;
}