Skip to content

Commit

Permalink
Hide cpseo meta key data in custom fields on post edit page (#76)
Browse files Browse the repository at this point in the history
Temporary workaround for #69 .
  • Loading branch information
timbocode authored May 17, 2020
1 parent 0ef486d commit b7eee13
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions includes/class-common.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ public function __construct() {
$this->filter( 'auto_update_plugin', 'auto_update_plugin', 10, 2 );
}

$this->filter( 'is_protected_meta', 'hide_cpseo_meta', 10, 2 );

new Admin_Bar_Menu;
}

Expand Down Expand Up @@ -201,6 +203,19 @@ private function get_stopwords() {

return array_unique( array_merge( $stopwords, $custom ) );
}


/**
* Hide cpseo meta keys
*
* @param bool $protected Whether the key is considered protected.
* @param string $meta_key Meta key.
*
* @return bool
*/
public function hide_cpseo_meta( $protected, $meta_key ) {
return Str::starts_with( 'cpseo_', $meta_key ) ? true : $protected;
}

/**
* Filters the permalink for a post of a custom post type.
Expand Down

0 comments on commit b7eee13

Please sign in to comment.