Skip to main content

Google Preferred Source CTA Plugin for WordPress

· 4 min read
Victor Jimenez
Software Engineer & AI Agent Builder

I built a lightweight WordPress plugin that encourages users to follow a site on Google News and set it as a preferred source. When a user follows your publication, they are more likely to see your content in Discover and "For You" feeds. This plugin makes adding that CTA a one-step operation.

Why Google Preferred Sources Matter

When a user "follows" your publication on Google News, they are more likely to see your content in their "For You" feed and Discover. Setting a site as a "Preferred Source" (or just Following) is a strong signal to Google's algorithms that your content is valued by that specific user.

Most publishers know this matters but do not have a clean way to prompt users. This plugin adds a high-conversion CTA that auto-appends to posts or drops in via shortcode.

Tech Stack

ComponentTechnologyWhy
PlatformWordPressTarget CMS for publishers
Coding standardsPHPCS (WordPress standard)Verified compliance
TestingPHPUnit + Brain MonkeyNo WordPress database needed for tests
CTA styleGoogle-branded, modern UIFits naturally into themes
LicenseMITOpen for adoption

Features

  • Admin Settings: Easily configure your Google News Publication URL.
  • Auto-append CTA: Automatically add a high-conversion call-to-action at the bottom of every post.
  • Shortcode Support: Use [google_preferred_source] to place the CTA anywhere in your layouts.
  • Modern UI: A clean, Google-branded CTA box that fits naturally into modern WordPress themes.
Use the Shortcode for Landing Pages

The auto-append works great for blog posts, but for landing pages or custom layouts, the [google_preferred_source] shortcode gives you precise placement control without touching templates.

Verify Your Google News Publication URL First

If the configured URL is empty or set to #, the CTA renders nothing. Test with a real Google News publication URL before going live, otherwise your readers see... nothing.

src/GooglePreferredSource.php
public function render_shortcode() {
$options = get_option( $this->option_name );
$url = isset( $options['google_news_url'] ) ? $options['google_news_url'] : '#';

if ( empty( $url ) || '#' === $url ) {
return ''; // No URL configured — render nothing
}

// Render the CTA box...
}

Why this matters for Drupal and WordPress

Google's preferred source signals apply to any publisher, regardless of CMS. This WordPress plugin demonstrates the pattern -- auto-append or shortcode CTA -- that Drupal publishers can replicate as a custom block or Twig template snippet. Drupal sites using the Google News sitemap module already have the publication URL; adding a follow CTA is the missing conversion step. For WordPress publishers, this plugin is drop-in ready. For Drupal publishers, the same CTA markup and Google News URL structure work identically -- the only difference is the delivery mechanism (block plugin vs. WordPress shortcode).

Next Steps

Future iterations could include:

  • Analytics tracking for CTA clicks.
  • Gutenberg block for more visual placement control.
  • Integration with Google Search Console API to verify publication status.
Plugin file structure
wp-google-preferred-source-demo/
wp-google-preferred-source.php
src/
GooglePreferredSource.php
Admin/
Settings.php
assets/
css/
cta-styles.css
tests/
GooglePreferredSourceTest.php

References


Looking for an Architect who doesn't just write code, but builds the AI systems that multiply your team's output? View my enterprise CMS case studies at victorjimenezdev.github.io or connect with me on LinkedIn.