automattic/jetpack-newsletter 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

automattic/jetpack-newsletter

Composer 安装命令:

composer require automattic/jetpack-newsletter

包简介

Jetpack Newsletter functionality

README 文档

README

This package provides some of the newsletter functionality for Jetpack, including:

  • Settings page — A wp-admin settings screen for newsletter configuration (Jetpack > Newsletter).
  • URL helper — Centralized logic for generating the correct newsletter settings URL based on site type and configuration.
  • Reader link — An admin bar link to the WordPress.com Reader.
  • Daily Writing Prompt widget — A wp-admin dashboard widget that surfaces blogging prompts.

Other functionality remains in the subscriptions module of Jetpack itself.

Initialization

Settings, Reader_Link, and Writing_Prompt_Widget use singleton-style initialization. Call their init() methods early (e.g., on plugins_loaded):

use Automattic\Jetpack\Newsletter\Settings;
use Automattic\Jetpack\Newsletter\Reader_Link;
use Automattic\Jetpack\Newsletter\Writing_Prompt_Widget;

Settings::init();
Reader_Link::init();
Writing_Prompt_Widget::init();

Settings page

Registers a Jetpack > Newsletter submenu page in wp-admin with a React-based settings UI.

Filters

jetpack_show_newsletter_menu_item

Controls visibility of the Jetpack > Newsletter menu item. Defaults to true. Set to false to hide the menu item while keeping the page accessible via direct URL.

add_filter( 'jetpack_show_newsletter_menu_item', '__return_false' );

Reading page notice

When the subscriptions module is active, a notice is added to the wp-admin Settings → Reading page next to the "For each post in a feed" option. It clarifies that the RSS excerpt setting does not control newsletter emails and links to the Newsletter settings page.

URL helper

Urls::get_newsletter_settings_url() returns the wp-admin newsletter settings URL.

Reader link

activate_on_connection()

Reader_Link::activate_on_connection() auto-activates the wpcom-reader module when a site is first connected to WordPress.com. It skips activation if modules were previously initialized (e.g., the user disconnected and reconnected), respecting prior module choices.

Daily Writing Prompt widget

Writing_Prompt_Widget::init() registers a Daily Writing Prompt dashboard widget for users who can manage_options. The widget renders a hydration container and enqueues the writing-prompt build assets, which mount a React app that fetches the latest blogging prompts from /wpcom/v3/blogging-prompts and lets the user jump into answering one.

Using this package in your WordPress plugin

If you plan on using this package in your WordPress plugin, we would recommend that you use Jetpack Autoloader as your autoloader. This will allow for maximum interoperability with other plugins that use this package as well.

Security

Need to report a security vulnerability? Go to https://automattic.com/security/ or directly to our security bug bounty site https://hackerone.com/automattic.

License

Jetpack Newsletter is licensed under GNU General Public License v2 (or later)

统计信息

  • 总下载量: 2.79k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 4
  • 依赖项目数: 1
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: GPL-2.0-or-later
  • 更新时间: 2025-11-28

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固