HEX
Server: Apache
System: Linux pdx1-shared-a1-38 6.6.104-grsec-jammy+ #3 SMP Tue Sep 16 00:28:11 UTC 2025 x86_64
User: mmickelson (3396398)
PHP: 8.1.31
Disabled: NONE
Upload Files
File: //usr/local/wp/vendor/wp-cli/entity-command/features/post-url-to-id.feature
Feature: Get the post ID for a given URL

  Background:
    Given a WP install

  Scenario: Get the post ID for a given URL
    When I run `wp post get 1 --field=url`
    Then STDOUT should be:
      """
      https://example.com/?p=1
      """
    And save STDOUT as {POST_URL}

    When I run `wp post url-to-id {POST_URL}`
    Then STDOUT should contain:
      """
      1
      """

    When I try `wp post url-to-id 'https://example.com/?p=404'`
    Then STDERR should contain:
      """
      Could not get post with url https://example.com/?p=404.
      """