Skip to content

Commit

Permalink
Merge pull request #2723 from QuizandSurveyMaster/CU-86cx5gqkq-fill-i…
Browse files Browse the repository at this point in the history
…n-the-blank-shortcode-issue

Replace wp kses with do shortcode
  • Loading branch information
zubairraeen authored Nov 27, 2024
2 parents e16f476 + fc21422 commit 055bdf0
Showing 1 changed file with 2 additions and 43 deletions.
45 changes: 2 additions & 43 deletions php/shortcodes.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,51 +44,10 @@ function qsm_quiz_link_shortcode( $atts, $content = '' ) {

// Craft the target attribute if one is passed to shortcode
$target_html = '';
$allowed_tags = apply_filters( 'qsm_quiz_link_allowed_tags', array(
'span' => array(
'class' => true,
'id' => true,
'style' => true,
),
'a' => array(
'href' => true,
'target' => true,
'class' => true,
'id' => true,
'rel' => true,
),
'img' => array(
'src' => true,
'alt' => true,
'width' => true,
'height' => true,
'class' => true,
'id' => true,
),
'div' => array(
'class' => true,
'id' => true,
'style' => true,
),
'h1' => array( 'class' => true ),
'h2' => array( 'class' => true ),
'h3' => array( 'class' => true ),
'h4' => array( 'class' => true ),
'h5' => array( 'class' => true ),
'h6' => array( 'class' => true ),
'p' => array(),
'br' => array(),
'b' => array(),
'strong' => array(),
'i' => array(),
'em' => array(),
'u' => array(),
) );

if ( ! empty( $target ) ) {
return "<a href='" . esc_url( $permalink ) . "' target='" . esc_attr( $target ) . "' class='" . esc_attr( $class ) . "'>" . wp_kses( $content, $allowed_tags ) . '</a>';
return "<a href='" . esc_url( $permalink ) . "' target='" . esc_attr( $target ) . "' class='" . esc_attr( $class ) . "'>" . do_shortcode( $content ) . '</a>';
} else {
return "<a href='" . esc_url( $permalink ) . "' class='" . esc_attr( $class ) . "'>" . wp_kses( $content, $allowed_tags ) . '</a>';
return "<a href='" . esc_url( $permalink ) . "' class='" . esc_attr( $class ) . "'>" . do_shortcode( $content ) . '</a>';
}
}

Expand Down

0 comments on commit 055bdf0

Please sign in to comment.