WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

We have a WordPress-based website that provides documentation to our REST API. Since our API is constantly changing, so is the documentation. However, we would like to keep the documentation version controlled so it can be matched against API commits. Is there a way to have WordPress pages get their content from a remote repository (GitHub, for example)? Or is there a way to push content to WordPress from some repository?

share|improve this question

You already got something like this built in: Revisions.

// Define the nr of saved revisions in your wp-config.php
define( 'WP_POST_REVISIONS', 30 );

You can simply grab them by calling get_posts() with a post_type of revision.

To show the difference between two revisions simply use wp_text_diff().

// Example
$revisions = get_posts( array(
    'post_type' => 'revision'
) );
echo wp_text_diff(
         'title'       => 'Revision diff'
        ,'title_left'  => $revisions[0]['post_title']
        ,'title_right' => $revisions[1]['post_title']
share|improve this answer
I like the idea of Revision. And there's a popular plugin WP Document Revisions can help managing revisions better. – Rilwis Oct 31 '12 at 2:01
@Rilwis Should be an answer then :) – kaiser Oct 31 '12 at 2:10

You could use a Git hook and post per XML-RPC to WordPress. A Git hook can be any executable file, even PHP.

Another option – on GitHub – is to use the email hook: Go to https://github.com/username/projectname/admin/hooks, select Email and send an email to the blog. Enable the Post per email feature.

share|improve this answer
+1 Now we just need a combination of both features (built as solid plugin by the OP) :) – kaiser Oct 29 '12 at 19:07

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.