WordPress Customizer Typography: How to load just the unique Google Fonts?

This question is way too broad for a complete answer in a Q&A format, but here is roughly what I would do: Collect all system fonts in an array $sys_fonts Collect all Google fonts in an array $ggl_fonts Collect the complete info about Google fonts in a multidimensional array $ggl_fontinfo Merge $sys_fonts and $ggl_fonts in … Read more

get WP-API by page id

If you want to use v2 of the API (which is the current one you should be using), the endpoint is mysite.me/wp-json/wp/v2/pages/1234 where 1234 is the page ID. https://developer.wordpress.org/rest-api/reference/pages/#retrieve-a-page

wordpress wp-json prefix issue

You need to set the permalink structure of your website. Goto Settings > Permalink. Remove index.php from the Custom Structure. Click on Save Changes. It re-generate your permalink structure. And you’ll be able to access the posts with http://example.com/index.php/wp-json/wp/v2/posts Updated: .htaccess code like below: # BEGIN WordPress <IfModule mod_rewrite.c> RewriteEngine On RewriteBase /dev.fresh/ RewriteRule ^index\.php$ … Read more

How to use the new WordPress 4.4 JSON API?

The WP REST API is being developed for WordPress as a Feature Plugin. A Feature Plugin is: … the way for features to be developed for inclusion in WordPress core. This model allows a feature to be built, tested, refined, and polished before it is considered as a merge candidate source: https://make.wordpress.org/core/handbook/about/release-cycle/features-as-plugins/ Therefore, the WP … Read more

How to retrieve wp_ json_encode data from custom WordPress database table

$wpdb->get_results() returns an Array of rows representing the results. The rows themselves can be represented as objects or arrays depending on the second argument. See the documentation: output_type One of four pre-defined constants. Defaults to OBJECT. See SELECT a Row and its examples for more information. OBJECT – result will be output as a numerically … Read more

Sending POST Request from server

‘wp_remote_post’ is the function you’re searching for. $response = wp_remote_post( $url, array( ‘method’ => ‘POST’, ‘timeout’ => 45, ‘redirection’ => 5, ‘httpversion’ => ‘1.0’, ‘blocking’ => true, ‘headers’ => array(), ‘body’ => array( ‘param1’ => ‘value1’ ), ‘cookies’ => array() ) ); if ( is_wp_error( $response ) ) { $error_message = $response->get_error_message(); echo “Something went … Read more

JSON: schedule creation of json file

My idea was to schedule this function, so it will run once every day or so. After some more research I should be able to fix this (using this post). Note that WP_Cron setted to daily is impossible to control exactly at what time the creation happen. If no one visit your site on night … Read more