WordPress – Page 10

Create a Post with WordPress REST API from Remote Website

How to Get Posts with REST API

If you’ve never worked with WordPress REST API before, then I am definitely recommend you to start with this tutorial, in which we are going to code some basic interactions with REST API using PHP and JavaScript. And as an example we’re just going to get posts from another WordPress blog.

First thing first we need to decide which blog’s posts we are going to get. I can not use my own blog for this example because I have REST API disabled :) I think we can use Matt Mullenweg’s blog for this example who is the founder of WordPress and whose blog has an open REST API (we can easily check it if we type in the browser: ma.tt/wp-json). So, the long story short WordPress REST API allows us to get posts from almost any WordPress blog and to display them either on another website or in a mobile app.

Let’s try to visit this URL then ma.tt/wp-json/wp/v2/posts. You can see that all the latest posts are displayed in your browser tab in JSON format.

WordPress API get posts in JSON format

And maybe the next question will be – what can we do with this JSON? Ok, right now I am about to show you two examples how to work with it with PHP and JavaScript functions.

How to Configure Self-Hosted Updates for Your Private Plugins

In this tutorial I will show you how to develop a custom update repository for your private plugin. It will be helpful if you’re developing plugins for sale.

We are not going to use any ready or bloated PHP-libraries for that, only two filter hooks plugins_api and site_transient_update_plugins and transient cache, that’s all.

You can also download the full code as a ready plugin from my GitHub.

WordPress plugin update from a custom server

Previous Next Post Navigation for Multiple Post Types at once

How to Combine AJAX load more button with AJAX filters

Upload Files to Media Library Programmatically

When you upload files to your website using media uploader in admin area, WordPress usually handles everything for you. So all the uploaded files automatically appear in WordPress media library and after that can be easily managed, inserted to posts etc.

But when you create some custom functionality, or maybe forms on your website front-end, you should handle it by yourself. And in this tutorial I will show you how.

add images to WordPress media library programatically
It is easier to organize your uploaded images using WordPress Media Library. Photos by me.

In this tutorial we are going to take a look on two scenarios:

  1. When upload images from url (not only images of course),
  2. When upload files using a form.

Add ID and Parent Comment ID Columns to the Comments Table in /wp-admin