This issue still not fixed after 5 months ??
The code below is having a huge impact on the site’s performance!
It filters all content of all post types and do all shortcodes to that contents (easydocs/shortcodes/reference.php
)
add_filter( 'the_content', function ( $ezd_content ) {
$ezd_options = get_option( 'eazydocs_settings' );
$is_notes_title = $ezd_options['is_footnotes_heading'] ?? '1';
$notes_title_text = $ezd_options['footnotes_heading_text'] ?? __( 'Footnotes', 'eazydocs' );
$footnotes_column = $ezd_options['footnotes_column'] ?? '1';
$all_shortcodes = ezd_all_shortcodes( $ezd_content );
$all_shortcoded = '';
foreach ( $all_shortcodes as $all_shortcode ) {
$all_shortcoded .= '<span>' . do_shortcode( $all_shortcode[0] ) . '</span>';
}
$ezd_footnote_title = '';
if ( ! empty( $notes_title_text ) && $is_notes_title == '1' && has_shortcode( $ezd_content, 'reference' ) ) {
$ezd_footnote_title = sprintf( '<div class="ezd-footnote-title">%s</div>', $notes_title_text );
}
$footnotes_contents = '';
if ( has_shortcode( $ezd_content, 'reference' ) ) {
$footnotes_contents = $ezd_footnote_title . "<div ezd-data-column='" . $footnotes_column . "' class='ezd-footnote-footer'>" . $all_shortcoded
. "</div>";
}
return $ezd_content . $footnotes_contents;
} );
You should apply this filter to certain post types ONLY
And ONLY when the content has ‘reference’ shortcode
Or at least provide a function name so we can remove the filter.
function ezd_reference_content_filter($content) {
$types = apply_filters('ezd_xxxx', ['doc']);
if ( !in_array( get_post_type(), $types ) || !has_shortcode( $content, 'reference' ) ) {
return $content;
}
xxxxxx
xxxxxx
return $content;
}
add_filter( 'the_content', 'ezd_reference_content_filter' );
Thanks in advance