-
Notifications
You must be signed in to change notification settings - Fork 98
Customizing WordPress GitHub Sync with Filters
string $msg Full export commit message.
This is the commit message for doing a full site export. The filter passes in the current commit message. You should return a string with your custom commit message.
WordPress_GitHub_Sync_Post $post Post object being deleted.
This is the commit message when deleting a single post. The filter passes in the current commit message and the WordPress_GitHub_Sync_Post object currently being exported. You should return a string with your custom commit message.
WordPress_GitHub_Sync_Post $post Unpublished post object directory source.
This is the directory for exporting unpublished posts. The filter passes in the current directory (_drafts
) and the WordPress_GitHub_Sync_Post object currently being exported. You should return a string with your custom drafts folder name.
WordPress_GitHub_Sync_Post $post Published post object directory source.
This is the directory for exporting published posts. The filter passes in the current directory, which is based on the post_type, and the WordPress_GitHub_Sync_Post object currently being exported. You should return a string with your custom published folder name.
WordPress_GitHub_Sync_Post $post Post object filename source.
This is the filename for exporting posts. The filter passes in the current filename, which is post_name (i.e. the slug), and the WordPress_GitHub_Sync_Post object currently being exported. You should return a string with your custom filename.
array $meta Post export meta.
WordPress_GitHub_Sync_Post $post Post meta source.
This is the meta array which gets converted to the YAML frontmatter on export. The filter passes in the current meta array and the WordPress_GitHub_Sync_Post object currently being exported.
By default the YAML frontmatter catches all the post's meta, but exclude any that begin with _
, as that is considered private. If you'd like to export that data, you should merge any additional meta into the array and return the new array.
Make sure the array key for your new meta matches the meta_key
of the post_meta
. Do NOT modify or remove any of the default keys in the array, as they are required by WordPress<-->GitHub Sync. These are listed below:
* 'ID'
* 'post_title'
* 'author'
* 'post_date'
* 'post_excerpt'
* 'layout'
* 'permalink'
* 'published'
string $content Post export content.
WordPress_GitHub_Sync_Post $post Post content source.
This filter is fired before the post content is exported from WordPress. Use it to make any last conversions before the content is exported. Make sure you reverse the conversion on the import hook.
string $content Post export content.
WordPress_GitHub_Sync_Post $post Post content source.
This filter is fired before the post content is imported from GitHub. Use it to reverse any conversions made on export to GitHub.
string $line_ending Line ending to normalize export with. Defaults to "\n".
This filter returns the line ending the posts exported to GitHub are normalized to. Use it to set your preferred default line ending.
array $args Post save args.
WordPress_GitHub_Sync_Post $post Post args source.
This filter is fired before imported posts are are saved to the database. Use it to add arguments to the update/insert calls.
array $meta Post export meta.
WordPress_GitHub_Sync_Post $post Post meta source.
This filter is called before the post meta is saved to the object. Use it to save the post meta to another location and return only the data you want to save to the post's meta.
string $branch Branch to sync. Defaults to "master".
The branch the WordPress install should sync itself with.
string $tag Tag to append. Defaults to "wpghs".
A tag appended to the end of the commit message which is appended with a -
. The tag is used to validate whether the commit has been synced to this WordPress install yet.