Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion plugin/includes/rest.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,9 @@ public function get_rest_field( $object, $field_name, $request ) {
*/
public function update_rest_field( $value, $object ) {

update_post_meta( $object->ID, 'wps_subtitle', wp_kses_post( $value ) );
$subtitle = new WP_Subtitle( $object->ID );

$subtitle->update_subtitle( wp_kses_post( $value ) );

}

Expand Down
4 changes: 2 additions & 2 deletions plugin/includes/subtitle.php
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ public function update_subtitle( $subtitle ) {
*/
public function is_current_subtitle( $subtitle ) {

return $subtitle === get_metadata( 'post', $this->post_id, 'wps_subtitle', true );
return $subtitle === get_metadata( 'post', $this->post_id, $this->get_post_meta_key(), true );

}

Expand All @@ -144,7 +144,7 @@ public function is_current_subtitle( $subtitle ) {
*
* @return string The subtitle meta key.
*/
private function get_post_meta_key() {
public function get_post_meta_key() {

return apply_filters( 'wps_subtitle_key', 'wps_subtitle', $this->post_id );

Expand Down
4 changes: 3 additions & 1 deletion plugin/plugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,9 @@ public static function _get_post_meta( $post = 0 ) {
*/
public static function _get_post_meta_key( $post_id = 0 ) {

return apply_filters( 'wps_subtitle_key', 'wps_subtitle', $post_id );
$subtitle = new WP_Subtitle( $post_id );

return $subtitle->get_post_meta_key();

}

Expand Down