humanmade/clean-up-leftover-multi-meta 问题修复 & 功能扩展

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

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

humanmade/clean-up-leftover-multi-meta

最新稳定版本:0.1.0

Composer 安装命令:

composer require humanmade/clean-up-leftover-multi-meta

包简介

Remove duplicate meta values for any single meta key with multiple meta value rows in the database.

README 文档

README

There is a potential bug in the REST API (identified by @MiguelAxcarHM, and being discussed between @TimothyBJacobs and @kadamwhite here in WordPress core Slack) where updates to meta values can fail unexpectedly because of unrelated other meta.

Our working theory is that this happens when a meta key is registered (using register_meta or register_post_meta) with 'single' => true, but that meta key still has multiple rows in the database as you would expect if it was previously used as 'single' => false. For example,

+---------+---------+---------------------------------------------+---------------+
| meta_id | post_id | meta_key                                    | meta_value    |
+---------+---------+---------------------------------------------+---------------+
|    8898 |    5804 | process_owner                               | 333           |
|   11870 |    5804 | process_owner                               | 333           |
|   13868 |    5804 | process_owner                               | 333           |
|   15748 |    5804 | process_owner                               | 333           |
+---------+---------+---------------------------------------------+---------------+

This plugin provides a CLI command which can be used to iterate through all posts of a post type, check for registered meta for that post, and identify whether any single-registered meta keys have duplicated rows in the postmeta table. The duplicated meta IDs are then cleaned out.

If a meta key has multiple rows for a post with different values, we should leave those alone.

Example command:

wp clean-up-leftover-multi-meta --post-type=my-cpt-name --dry-run

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: GPL-2.0-or-later
  • 更新时间: 2022-09-26

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固