F
Remove the wpautop filter before processing your field, and don't forget get it back:remove_filter ( 'the_content', 'wpautop');
echo apply_filters('the_content', get_post_meta($post->ID, 'Текст', true));
add_filter ( 'the_content', 'wpautop');
What's written in your commentary and then copied in another reply is a typical example of a bad code that works for a few things. I understand.You solved the problem with that line:<?php echo apply_filters(remove_filter('the_content', 'wpautop'), get_post_meta($post->ID, 'Текст', true)); ?>
What's going on here, really? remove_filter() returns only true or false (read description in codex). Next, you're making a call. apply_filters(true, get_post_meta($post->ID, 'Текст', true));
WordPress is silent about this filters, and it's not doing anything, and it's returning what it was. get_post_meta($post->ID, 'Текст', true)♪ In fact, you've just thrown out your code of application with such a clever crutch. That's the equivalent of your "chit" line:<?php echo get_post_meta($post->ID, 'Текст', true); ?>
So the line you've proposed is 1/3 of the code that it says, and it's going to stalemate any other programmer who doesn't know the current discussion. Don't do that.I've been trying to propose to just clean up the filters() but since you've got some more work to do with the content, and I don't see the code at all, I've offered the filters.UPDATE. I summarized all the options discussed in the reply and in the comments, http://test.kagg.eu/so707342/ ♪The page has its own php-chablon. The code of this coat:<?php
/*
Template Name: 707342
*/
echo 'shortcode: ' . do_shortcode('[short_code]') . '<br>';
echo 'apply_filters: ' . apply_filters('the_content', get_post_meta($post->ID, 'Текст', true)) . '<br>';
echo 'apply_filters(remove_filter: ' . apply_filters(remove_filter('the_content', 'wpautop'), get_post_meta($post->ID, 'Текст', true)) . '<br>';
echo 'post_meta: ' . get_post_meta($post->ID, 'Текст', true) . '<br>';
echo 'Правильный вариант (remove - apply - add): ';
remove_filter( 'the_content', 'wpautop' );
echo apply_filters( 'the_content', get_post_meta($post->ID, 'Текст', true) );
add_filter( 'the_content', 'wpautop' );
echo '<br>';
echo 'Правильный вариант (do_shortcode): ';
echo do_shortcode( get_post_meta($post->ID, 'Текст', true) );
echo '<br>';
In functions.php:function test_short_code() {
return 'https://google.com';
}
add_shortcode('short_code','test_short_code');
As you can see, it's not working. Just because I wrote out, he's just returning to get_post_meta.