Disable Google ads on code level

Posted in: Newspaper
Post count: 13

Dear all,

I have two versions of the website, production and staging. Production version is running Google ads. From time to time I sync the database, and then every time I have to disable ads on my staging URL. How can I disable this on code level, so I don’t have this problem after each db sync?

Thank you.

Regards,
Nemanja.

Post count: 9544

Probably need a filter added to the functions.php file on your local copy to ‘force’ the ads option ‘off’ in the theme panel. Not sure how that would be done, but I don’t work here. Might need to hire a programmer for custom developer work on something like that, since not a normal theme function.

Sorry. Just a comment, not a solution.

Post count: 13

Hi Chris,

I know in theory how the process will go, but don’t know where to apply it 🙂

Post count: 13

Dear all,

Do you have any updates on this? Any usefull advice will help.

Thanks.

Regards,
Nemanja.

Post count: 22421

Hello,

Unfortunately we have not tested this so you will have to get some help from someone code savvy as Chris suggests because we do not have a customization department and time does not allow us to tackle ‘complex’ coding tasks. We try to help out where we can but the customization you are after, we would actually have to make it ourselves and test it out before we provide an answer and as you can imagine this is not doable unless we have a customization department that can work on specific tasks as you require.

Thank you for your understanding!

Post count: 9544

Probably simpler to use an actual advertising module/plugin for the ad spaces, then create a simple function to “disable” that plugin for your staging install. That’s what I would do, anyway.

Or, if you just want to disable ALL Google AdSense ads on your dev setup; look to see if AdSense has their own hook/filter which could be “injected” via function/plugin on your local install into the header. Like some sort of “sandbox” mode to wrap the page, or header “ignore” element, etc., “disable adsense javascript” or whatever?

( I don’t work here. )

  • This reply was modified 9 years by simchris.
  • This reply was modified 9 years by simchris.
Viewing 6 posts - 1 through 6 (of 6 total)
The forum ‘Newspaper’ is closed to new topics and replies.