Skip to content

Commit

Permalink
Hide the post meta in the wp-admin
Browse files Browse the repository at this point in the history
  • Loading branch information
keesiemeijer committed Nov 1, 2018
1 parent 71aca51 commit be898cb
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
16 changes: 8 additions & 8 deletions lib/class-importer.php
Original file line number Diff line number Diff line change
Expand Up @@ -858,26 +858,26 @@ protected function _set_namespaces( $post_id, $namespaces ) {
protected function _set_since_meta( $post_id, $since_versions, $deprecated_version ) {
$anything_updated = array();
$introduced_version = array_shift( $since_versions );
$introduced = isset( $introduced_version['content'] ) && $introduced_version['content'];

$introduced = isset( $introduced_version['content'] ) && $introduced_version['content'];
if ( $introduced && maybe_version( $introduced_version['content'] ) ) {
$anything_updated[] = update_post_meta( $post_id, 'wp_parser_introduced', $introduced_version['content'] );
$anything_updated[] = update_post_meta( $post_id, '_wp-parser_introduced', $introduced_version['content'] );
} else {
delete_post_meta( $post_id, 'wp_parser_introduced' );
delete_post_meta( $post_id, '_wp-parser_introduced' );
}

$deprecated = isset( $deprecated_version['content'] ) && $deprecated_version['content'];
if ( $deprecated && maybe_version( $deprecated_version['content'] ) ) {
$anything_updated[] = update_post_meta( $post_id, 'wp_parser_deprecated', $deprecated_version['content'] );
$anything_updated[] = update_post_meta( $post_id, '_wp-parser_deprecated', $deprecated_version['content'] );
} else {
delete_post_meta( $post_id, 'wp_parser_deprecated' );
delete_post_meta( $post_id, '_wp-parser_deprecated' );
}

$old_meta = get_post_meta( $post_id, 'wp_parser_modified' );
$old_meta = get_post_meta( $post_id, '_wp-parser_modified' );
$new_meta = array();

// Delete modified meta and check if anything was updated after adding new meta.
delete_post_meta( $post_id, 'wp_parser_modified' );
delete_post_meta( $post_id, '_wp-parser_modified' );

if ( ! empty( $since_versions ) ) {
foreach ( $since_versions as $since ) {
Expand All @@ -887,7 +887,7 @@ protected function _set_since_meta( $post_id, $since_versions, $deprecated_versi
}

$new_meta[] = $since['content'];
add_post_meta( $post_id, 'wp_parser_modified', $since['content'] );
add_post_meta( $post_id, '_wp-parser_modified', $since['content'] );
}
}

Expand Down
4 changes: 2 additions & 2 deletions lib/template.php
Original file line number Diff line number Diff line change
Expand Up @@ -348,12 +348,12 @@ function maybe_version( $version ) {
/**
* Whether a version should be checked or not.
*
* This filter allows you to do your own version validation by returning a boolean.
* Return boolean to validate the version yourself.
*
* @param mixed $check_version. Whether to check the version or not. Default null.
* @param string $version Version string.
*/
$check_version = apply_filters( 'wp_parser_maybe_version', null, $version );
$check_version = apply_filters( 'wp_parser_check_version', null, $version );
if ( is_bool( $check_version ) ) {
return $check_version;
}
Expand Down

0 comments on commit be898cb

Please sign in to comment.