apply_filters ( 'wordads_ads_txt', string WordAds_API::get_wordads_ads_txt() )

Provide plugins a way of modifying the contents of the automatically-generated ads.txt file.

Source file: modules/wordads/class-wordads.php

View in GitHub



(string) WordAds_API::get_wordads_ads_txt() The contents of the ads.txt file.


Since: Jetpack 6.1.0


You can use this filter to add your custom texts from other ad programs.

add_filter( 'wordads_ads_txt', 'htdat_wordads_ads_txt'); 

function htdat_wordads_ads_txt ( $ads_txt_transient ) {
  $my_text = "#My custom texts";
  $my_text .= "\r\n"; // new line 	
  $my_text .= ", pub-0000000000000000, DIRECT, f08c47fec0942fa0"; // Edit your own text here
  $my_text .= "\r\n \r\n"; // two new lines 
  return $my_text . $ads_txt_transient; 

Have a note to contribute?

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s