$atts['orderby'] = 'none';
}
+ if ( $atts['type'] !== 'audio' ) {
+ $atts['type'] = 'video';
+ }
+
$args = array(
'post_status' => 'inherit',
'post_type' => 'attachment',
$html_atts = array(
'class' => apply_filters( 'wp_audio_shortcode_class', 'wp-audio-shortcode' ),
'id' => sprintf( 'audio-%d-%d', $post_id, $instances ),
- 'loop' => $atts['loop'],
- 'autoplay' => $atts['autoplay'],
+ 'loop' => wp_validate_boolean( $atts['loop'] ),
+ 'autoplay' => wp_validate_boolean( $atts['autoplay'] ),
'preload' => $atts['preload'],
'style' => 'width: 100%; visibility: hidden;',
);
'width' => absint( $atts['width'] ),
'height' => absint( $atts['height'] ),
'poster' => esc_url( $atts['poster'] ),
- 'loop' => $atts['loop'],
- 'autoplay' => $atts['autoplay'],
+ 'loop' => wp_validate_boolean( $atts['loop'] ),
+ 'autoplay' => wp_validate_boolean( $atts['autoplay'] ),
'preload' => $atts['preload'],
);
if ( $attachment->post_parent ) {
$post_parent = get_post( $attachment->post_parent );
+ } else {
+ $post_parent = false;
+ }
+
+ if ( $post_parent ) {
$parent_type = get_post_type_object( $post_parent->post_type );
if ( $parent_type && $parent_type->show_ui && current_user_can( 'edit_post', $attachment->post_parent ) ) {
$response['uploadedToLink'] = get_edit_post_link( $attachment->post_parent, 'raw' );