M
M
Minusator2018-09-10 19:16:36
WordPress
Minusator, 2018-09-10 19:16:36

Is it possible to do this in code?

Good afternoon!
In one of the wordpress plugins I found this piece of code.
What does $update do? I understand correctly that the variable was declared but not written further in the code?

public function save_badge_metadata ( $post_id, $post, $update ) {



      if ( 'mycred_badge' != $post->post_type ) {

        return;

      }



      $badge_description = '';

      if ( isset( $_POST[ 'gfy_badge_description' ] ) ) {

        $badge_description = sanitize_text_field( $_POST[ 'gfy_badge_description' ] );

      }

      update_post_meta( $post_id, 'gfy_badge_description', $badge_description );

    }

Answer the question

In order to leave comments, you need to log in

1 answer(s)
P
Pavel, 2018-09-10
@Minusator

$updateis an argument that this method can take, but is not used in any way inside the method. Maybe it's left from previous versions, maybe it's a reserve for the future)) Plugins are written by the same people, and they make the same mistakes.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question