Can I use the REST API to modify a shortcode? Seems not to work… (I changed the show_in_rest to true already). Here’s a snippet of my python code.
def update_wordpress_post(html_content):
wordpress_url = f"{rest_api_endpoint}{post_id}" # REST API URL for creating a post
username = "username"
password = "application_pwd"
# Prepare the data for the request
data = {
"title": "name_of_the_shortcode", # Set the title of the post
"content": html_content, # The generated HTML content
"status": "publish" # Publish the post immediately
}
# Make the POST request to the WordPress API
response = requests.post(
wordpress_url,
json=data,
auth=HTTPBasicAuth(username, password) # Basic Auth using username and app password
)