Find wordpress post by id
From UBot Studio
(Difference between revisions)
(Created page with "'''$find wordpress post''' is a function that retrieves a specific post or page from a WordPress site using its ID. The function will return the entire post as a string, incl...") |
|||
Line 1: | Line 1: | ||
'''$find wordpress post''' is a function that retrieves a specific post or page from a WordPress site using its ID. | '''$find wordpress post''' is a function that retrieves a specific post or page from a WordPress site using its ID. | ||
− | |||
− | |||
== Parameters == | == Parameters == | ||
Line 8: | Line 6: | ||
== Return Value == | == Return Value == | ||
− | This function returns a | + | This function returns a yaml object which contains the entire post, including its title and contents and other relevant data. |
== Example == | == Example == | ||
<pre> | <pre> | ||
− | + | ui console view | |
+ | connect to wordpress("https://yourwordpresssite.com", "username", "password") | ||
create wordpress post("My New Blog Post", "This is the content of my new blog post.", "public", "post", #my post id) | create wordpress post("My New Blog Post", "This is the content of my new blog post.", "public", "post", #my post id) | ||
− | + | log object($find wordpress post(#my post id)) | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
</pre> | </pre> | ||
Latest revision as of 01:23, 4 July 2023
$find wordpress post is a function that retrieves a specific post or page from a WordPress site using its ID.
[edit] Parameters
Post ID: The ID of the post or page you want to retrieve.
[edit] Return Value
This function returns a yaml object which contains the entire post, including its title and contents and other relevant data.
[edit] Example
ui console view connect to wordpress("https://yourwordpresssite.com", "username", "password") create wordpress post("My New Blog Post", "This is the content of my new blog post.", "public", "post", #my post id) log object($find wordpress post(#my post id))
This script creates a new public post on your WordPress website, saves its ID, and then retrieves and prints the post using its ID.
Remember to replace "https://yourwordpresssite.com", "username", and "password" with your WordPress site's URL, your username, and your password, respectively. Replace "My New Blog Post" and "This is the content of my new blog post." with your own title and content.