Retrieve language of a WordPress post using the WordPress API

Tiempo de lectura: < 1 minuto html Copy code posts} AS wp_posts JOIN {$wpdb->term_relationships} AS wp_term_relationships ON (wp_posts.ID = wp_term_relationships.object_id) JOIN {$wpdb->terms} AS wp_terms ON (wp_term_relationships.term_taxonomy_id = wp_terms.term_id) JOIN {$wpdb->term_taxonomy} AS wp_term_taxonomy ON (wp_terms.term_id = wp_term_taxonomy.term_id) WHERE wp_posts.ID = %d AND wp_term_taxonomy.taxonomy = ‘language’ “, $post->ID)); // Add the language to the response object $response->data[‘language’] = $language; return $response; } add_filter(‘rest_prepare_post’, … Read more

Sending Meta Keywords and Description with WordPress API and Using Them in Any Theme

Sending Meta Keywords and Description with WordPress API and Using Them in Any Theme

Tiempo de lectura: 2 minutos And now we check if the added Keywords and Description are displayed. To do this, we open our post in the browser and right-click to inspect. The code inspector will appear, and we type Keywords, and the Keywords will appear: Same for the description: And now we add it to our POST, for that we … Read more

Fetching WordPress Categories with Python API

Fetching WordPress Categories with Python API

Tiempo de lectura: 3 minutos Reading time: < 1 minute Today we are going to learn how to fetch categories from the WordPress API. Let’s create a python file named code.py with the following content: import os from dotenv import load_dotenv import requests import json import random from requests.auth import HTTPBasicAuth def fetch_categories(): load_dotenv() WORDPRESS_USERNAME = os.getenv("WORDPRESS_USERNAME") WORDPRESS_PASSWORD = os.getenv("WORDPRESS_PASSWORD") ... Read more