HEX
Server: LiteSpeed
System: Linux us-phx-web629.main-hosting.eu 5.14.0-503.23.2.el9_5.x86_64 #1 SMP PREEMPT_DYNAMIC Wed Feb 12 05:52:18 EST 2025 x86_64
User: u756937133 (756937133)
PHP: 8.2.30
Disabled: passthru,chgrp
Upload Files
File: //opt/.wp-cli/packages/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.
      """