Skip to content

Restore listing creation in the V1 REST API - #2951

Open
RabbiIslamRony wants to merge 1 commit into
sovware:developmentfrom
RabbiIslamRony:fix/1133-v1-listing-create-endpoint
Open

Restore listing creation in the V1 REST API#2951
RabbiIslamRony wants to merge 1 commit into
sovware:developmentfrom
RabbiIslamRony:fix/1133-v1-listing-create-endpoint

Conversation

@RabbiIslamRony

Copy link
Copy Markdown
Member

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Security fix
  • Improvement
  • New Feature
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • Text changes
  • Other... Please describe:

Description

How to reproduce the issue or how to test the changes

  1. Authenticate with a user that has the Directorist listing publish capability and POST name=my_new_listing to /wp-json/directorist/v1/listings.
  2. Confirm the response is HTTP 201, retains the V1 response field names, and includes a V1 listing URL in the Location header.
  3. Repeat with the flat V1 directory, category, location, tag, pricing, map, and contact fields; confirm only builder-configured fields are stored and duplicate taxonomy IDs are removed.
  4. Omit directory and confirm the default directory is used. Then supply invalid directory and taxonomy IDs and confirm HTTP 400 responses.
  5. Confirm an anonymous request returns 401, a user without the listing publish capability returns 403, and the existing V2 create request still returns 201.

The V1 controller now adapts its documented flat schema to the current builder-aware submission service. Existing attachment IDs require image and edit checks, taxonomy terms are validated against their taxonomy and directory, and V2 remains unchanged.

Any linked issues

Fixes #1133

Checklist

@RabbiIslamRony

Copy link
Copy Markdown
Member Author

The reported PHPCS failure occurs in the inherited pull_request_target workflow before source checkout, so the PHPCS step never runs. PR #2945 replaces that unsafe workflow with the fork-safe pull_request workflow. The changed PHP file passes the repository rules locally with zero errors.

@RabbiIslamRony

Copy link
Copy Markdown
Member Author

A focused LocalWP retest against the current PR head also passed the taxonomy adapter path: an authenticated V1 POST with a valid directory and category returned HTTP 201, included the V1 listing Location header, and created the expected listing. The temporary listing and application password were removed after the check.

@Armanul46 Armanul46 added this to the v8.9.3 milestone Aug 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants