Skip to content

Latest commit

 

History

History
57 lines (39 loc) · 1.17 KB

File metadata and controls

57 lines (39 loc) · 1.17 KB

Hooking into entries

Five filters let you alter entries at different stages of their lifecycle.

Before inserting into the database

add_filter( 'liveblog_before_insert_entry', array( __CLASS__, 'filter' ), 10 );

public static function filter( $entry ) {
	return $entry;
}

Before inserting an updated entry into the database

add_filter( 'liveblog_before_update_entry', array( __CLASS__, 'filter' ), 10 );

public static function filter( $entry ) {
	return $entry;
}

Before showing a preview

This is where :emoji: is converted back to <img>:

add_filter( 'liveblog_before_preview_entry', array( __CLASS__, 'filter' ), 10 );

public static function filter( $entry ) {
	return $entry;
}

Before allowing an entry to be edited

This is where <img> is converted back to :emoji::

add_filter( 'liveblog_before_edit_entry', array( __CLASS__, 'filter' ), 10 );

public static function filter( $content ) {
	return $content;
}

Before the entry JSON is sent to the front end

add_filter( 'liveblog_entry_for_json', array( __CLASS__, 'filter' ), 10, 2 );

public static function filter( $entry, $object ) {
	return $entry;
}