title: How do I overwrite WordPress core functions?
body: <p>This is my first time touching WordPress, and I have the task of extracting the core functions that have been customized and putting them in a non-core file so that it's more maintainable when we upgrade. Here's an example of one of the methods in <code>wp-admin/includes/template.php</code> :</p>
  
  <p>Original code:</p>
  
  <pre><code>    function meta_form() {
          global $wpdb;
          $limit = (int) apply_filters( 'postmeta_form_limit', 30 );
          $keys = $wpdb-&gt;get_col( "
              SELECT meta_key
              FROM $wpdb-&gt;postmeta
              GROUP BY meta_key
              HAVING meta_key NOT LIKE '\_%'
              ORDER BY meta_key
              LIMIT $limit" );
          if ( $keys )
              natcasesort($keys);
      ?&gt;
  </code></pre>
  
  <p>Customized version:</p>
  
  <pre><code>function meta_form() {
      global $wpdb;
  
    if ( isset($_GET['post']) )
      $post_id = (int) $_GET['post'];
    elseif ( isset($_POST['post_ID']) )
      $post_id = (int) $_POST['post_ID'];
    else
      $post_id = 0;
  
    if ( $post_id ) {
      $post_ = get_post($post_id);
  
    }
  
    if ($post_-&gt;post_type == 'video_photo' ){
      $limit = (int) apply_filters( 'postmeta_form_limit', 30 );
      $keys = $wpdb-&gt;get_col( "
          SELECT meta_key
          FROM $wpdb-&gt;postmeta
      where meta_key like 'tqmcf_%'
          GROUP BY meta_key
          HAVING meta_key NOT LIKE '\_%'
          ORDER BY meta_key
          LIMIT $limit" );
    }else{
      $limit = (int) apply_filters( 'postmeta_form_limit', 30 );
      $keys = $wpdb-&gt;get_col( "
          SELECT meta_key
          FROM $wpdb-&gt;postmeta
  
          GROUP BY meta_key
          HAVING meta_key NOT LIKE '\_%'
          ORDER BY meta_key
          LIMIT $limit" );
    }
  
      if ( $keys )
          natcasesort($keys);
  ?&gt;
  </code></pre>
  
  <p>Where exactly would I define my <code>meta_form()</code> function to make sure it overwrites the core method? </p>