Leave a Reply

1 comment

  1. From the OPs edit moved to an answer.

    I found an answer, also not a straight path, I’m sure there’s a better way to do this.
    basically I use a little helper method that queries the SQL with the meta_id and return the post_id:

    <?php
    function get_key_by_id( $meta_ids )
    { 
        global $wpdb;
    
        $meta_ids = absint( $meta_ids );
    
        // Debugging:
        // $wpdb->show_errors();
    
        $meta_keys = $wpdb->get_var( $wpdb->prepare(
             "
                SELECT meta_key 
                FROM {$wpdb->postmeta}
                WHERE meta_id = %d
             "
            ,$meta_ids
        ) );
    
        // Debugging:
        // $wpdb->print_error();
    
        if ( $meta_keys )
            return $meta_keys; 
    
        // else:
        return false;
    }