Get wordpress posts
(Created page with "'''$find wordpress posts by type''' is a function that retrieves all posts of specific type from a WordPress site. This function will return a list of all posts of the specif...") |
|||
Line 12: | Line 12: | ||
== Example == | == Example == | ||
<pre> | <pre> | ||
− | + | connect to wordpress("https://yourwordpresssite.com", "username", "password") | |
− | + | log object($find wordpress posts by type("post")) | |
</pre> | </pre> | ||
Revision as of 01:40, 4 July 2023
$find wordpress posts by type is a function that retrieves all posts of specific type from a WordPress site.
This function will return a list of all posts of the specific type as a string format including the post IDs, titles, and content.
Parameters
Post Type: The type of the posts you want to retrieve. Options include "post" (for blog posts) and "page" (for static pages). Default is "post".
Return Value
This function returns a string which contains a list of all posts of the chosen type, including their IDs, titles, and contents.
Example
connect to wordpress("https://yourwordpresssite.com", "username", "password") log object($find wordpress posts by type("post"))
This script connects to your WordPress website and retrieves and prints all posts of type "post".
Remember to replace "https://yourwordpresssite.com", "username", and "password" with your WordPress site's URL, your username, and your password, respectively. Adjust "post" to the type of posts you want to retrieve.