Skip to content

Instantly share code, notes, and snippets.

@htdat
Last active May 4, 2018 09:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save htdat/76fbedaff7e8784db946e3d684718925 to your computer and use it in GitHub Desktop.
Save htdat/76fbedaff7e8784db946e3d684718925 to your computer and use it in GitHub Desktop.
Use the "wordads_ads_txt" filter since Jetpack 6.1. See the official guide at https://developer.jetpack.com/hooks/wordads_ads_txt/
<?php
add_filter( 'wordads_ads_txt', 'dat_wordads_ads_txt');
function dat_wordads_ads_txt ($ads_txt_transient) {
$my_text = "#Add more texts";
$my_text .= "\r\n"; // new line
$my_text .= "google.com, pub-0000000000000000, DIRECT, f08c47fec0942fa0"; // Edit your own text here
$my_text .= "\r\n \r\n"; // new line
return $my_text . $ads_txt_transient;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment