get_var( $wpdb->prepare( "SELECT p.ID FROM {$wpdb->postmeta} m JOIN {$wpdb->posts} p ON p.ID = m.post_id WHERE m.meta_key = %s AND m.meta_value = %s AND p.post_type = 'accessible_form' AND p.post_status <> 'trash' ORDER BY p.ID ASC LIMIT 1", self::META, $key ) ); } /** * The form a placement means. A key that names a form here wins over the ID, so * a page copied from another site cannot show a different form that happens to * have the same ID there. * * @param mixed $form_id Placement's form ID. * @param mixed $key Placement's key. * @return int */ public static function resolve( $form_id, $key ) { if ( ! is_string( $key ) ) { return 0; } $key = trim( $key ); return '' === $key ? absint( $form_id ) : self::find( $key ); } }