Opened 6 years ago

Closed 6 years ago

#3421 closed defect (bug) (fixed)

WP-CLI command reference generates duplicate posts

Reported by: schlessera's profile schlessera Owned by: danielbachhuber's profile danielbachhuber
Milestone: Priority: high
Component: Developer Hub Keywords: has-patch


The cron job that updates the WP-CLI command reference is currently generating massive amounts of duplicate posts.

This issue is due to the fact that CPT slugs share a namespace with other CPTs, and we hit this with commands like embed. The entire synchronization mechanism is built around the URL, and the embed command that has a conflict with _some_ other post on the site is created under the slug embed-2. This causes every check to detect the entry as an existing parent to fail and thus parents are re-created all the time.

I have a patch that normalizes the command path so that these added numeric suffixes are removed from the path that is used for all checks.

Attachments (2)

3421.diff (2.8 KB) - added by schlessera 6 years ago.
Normalize command paths
3421-2.diff (2.8 KB) - added by schlessera 6 years ago.
Fixed a small typo

Download all attachments as: .zip

Change History (5)

6 years ago

Normalize command paths

#1 @schlessera
6 years ago

The patch does the following:

  • normalize command paths to avoid duplicated items due to slug conflicts
  • add 'page-attributes' to CPT 'supports', so that parent posts can be manually inspected/modified
  • Only filter the queries for this CPT on the frontend, so that we keep access to all generated commands on the backend

#2 @schlessera
6 years ago

  • Keywords has-patch added

6 years ago

Fixed a small typo

#3 @danielbachhuber
6 years ago

  • Owner set to danielbachhuber
  • Resolution set to fixed
  • Status changed from new to closed

In 6545:

devhub/cli: Fix Daniel's broken importer code

Fixes #3421

Note: See TracTickets for help on using tickets.