Welcome notice checks for Otter at a hard-coded `wp-content/plugins` path

未关闭 适合新手
#121 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
1/5
预计耗时
1 小时以内
新手友好度
86/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃
技术栈
php, wordpress
领域
backend

调研方向

该检查位于 inc/Admin.php 中 get_otter_status() 内、大约第 304 行;打开该函数并确认其返回值如何选择 Install & Activate 还是 Activate 标签。将硬编码的 ABSPATH . 'wp-content/plugins/...' 路径替换为 WP_PLUGIN_DIR . '/otter-blocks/otter-blocks.php',或者针对该键测试 get_plugins(),其余函数保持不变。完成意味着当插件目录已通过 WP_PLUGIN_DIR 移动时,该通知会为已安装但未启用的 Otter 提供 Activate。

由索引模型根据 Issue 内容生成。

描述

What's wrong

The welcome notice ("Power up your website building experience with Otter Blocks!") decides between Install & Activate Otter Blocks and Activate Otter Blocks by checking for this file:

// inc/Admin.php, get_otter_status(), line 304
if ( file_exists( ABSPATH . 'wp-content/plugins/otter-blocks/otter-blocks.php' ) ) {

That path is only right when the plugins folder sits in the default place. On sites that move it (WP_CONTENT_DIR / WP_PLUGIN_DIR, as Bedrock and many managed hosts do), an installed but inactive Otter is reported as not installed. The button then says Install & Activate, asks WordPress to install a plugin that's already there (that request fails), and then activates it anyway. The end result works, but the label is wrong and an install request is wasted.

Found by reading the code; not reproduced on a moved plugins folder.

Suggested fix
if ( file_exists( WP_PLUGIN_DIR . '/otter-blocks/otter-blocks.php' ) ) {

or check get_plugins() for otter-blocks/otter-blocks.php.

主要语言
PHP
星标
0
派生
0
平均合并
1 小时 2 分钟
30 天内合并 PR
5

环境准备

  • 没有 Dockerfile 或 Docker Compose 文件
  • 有 Pull Request 模板
  • 没有贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

Codeinwp/fork 的其他 Issue

查看 Codeinwp/fork 的全部 Issue

相似的 Issue

更多 PHP Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。