Apps/WordPress/Search a post by its slug
WordPress
WordPress Action

Search a post by its slug

Allows you to search for an entry based on the slug and the type of entry (Public, Draft, Private, etc).

200+ apps to connect·Tested & maintained tasks·Human support in English & Spanish

In detail

What it does and what it's for

Automating tasks with WordPress is now easier with Botize. This integration allows you to search for specific posts on your WordPress site using their slug and post type, whether public, draft, or private.

Upon executing this action, you'll receive detailed information about the post, including its ID, URL, title, content, and excerpt. This streamlines the management and updating of your content in an efficient and automated manner.

How it works

How it fits in an automated task

A Botize task pairs a trigger with one or more actions. This piece is one of them.

Pick a trigger

The event that starts the task, from this app or any other.

This action runs

Botize performs it automatically using the data the trigger delivers.

Turn it on and forget it

The task runs on its own from then on. If something's off, tweak it or we'll help you.

Already using Botize?

Connect your WordPress

Add a profile to use it in your tasks. There's a step-by-step guide if you need it.

Add a new profile Step-by-step guide

Your profiles

Your connected WordPress accounts

These are the accounts you already have linked to Botize, ready to use in your tasks. You can reconnect or remove any of them.

Setup

Customization options

Fields you can adjust when using it in your automation.

Rules
Filters
Slug
Status
Context

Output data

Information provided

When executed, this operation delivers the following data, which can be used in the same automatic task.

  • Tags

  • Post Id {{post_id}}

  • Post URL {{post_url}}

  • Post Title {{post_title}}

  • Post Content {{post_content}}

  • Excerpt {{excerpt}}

Learn by watching

Video tutorials

Short videos where you watch a real task being built from start to finish.

Frequently Asked Questions


How do I configure my WordPress to read and update post metadata?

You need to update the `functions.php` file in WordPress and include the following code to allow metadata to be updated via the API:

function expose_metadata() {
      register_rest_field(
           'post',
           'post_meta_fields',
           array(
                'get_callback' => 'callback_read_post_meta',
                'update_callback' => 'callback_update_post_meta',
                'schema' => null,
           )
      );
}

function callback_read_post_meta( $object ) {
      $post_id = $object['id'];
      return get_post_meta( $post_id );
}

function callback_update_post_meta( $meta_value, $object, $field_name ) {
      $post_id = $object->ID;

      if (!is_array( $meta_value ) ) {
           return new WP_Error( 'rest_invalid_param', __( 'El valor debe ser un array de campos de metadatos.' ), array( 'status' => 400 ) );
      }

      foreach ( $meta_value as $meta_key => $meta_value ) {
           update_post_meta( $post_id, sanitize_key( $meta_key ), sanitize_text_field( $meta_value ) );
      }
      return true;
}

add_action( 'rest_api_init', 'expose_metadata' );

Common Errors


Error: rest_forbidden_context. Sorry, you are not allowed to edit posts in this post type.

This error indicates that the user doesn't have the necessary permissions to edit posts in the specific context where the action is being attempted.

To resolve this issue, it's necessary to ensure that the user has the appropriate permissions. An alternative that might work would be to modify the 'context' field in your task and select the option 'Extract the entry for viewing'.

Need a hand?

Real people behind it

Email us

info@botize.com
Monday to Friday from 7 a.m. to 1 p.m. (Spain).

Message us on Telegram

t.me/botize
Monday to Friday from 7 a.m. to 1 p.m. (Spain).

Come with an idea.
Leave with an automation.

Create your first task in minutes. Do it once and forget about it forever.

Start automating