WYSIWYG eating up first p in td
This error was corrected when I installed the plugin TinyMCE Advanced and activated the option “Stop removing the <p> and <br /> tags when saving …”.
This error was corrected when I installed the plugin TinyMCE Advanced and activated the option “Stop removing the <p> and <br /> tags when saving …”.
A bit involved, but this should work: function remove_wysiwyg() { global $pagenow; if ( ‘post.php’ == $pagenow ) { $type = get_post_type( $_GET[‘post’] ); if( ‘post’ != $type || ‘page’ != $type ) add_filter(‘user_can_richedit’, ‘__return_false’); } elseif ( ‘post-new.php’ == $pagenow ) { if( isset( $_GET[‘post_type’] ) && ‘page’ != $_GET[‘post_type’] ) add_filter(‘user_can_richedit’, ‘__return_false’); } … Read more
Ok if you want to strip the p tags for img’s and iframe’s for advanced custom fields you have to exchange the_content with acf_the_content . The code looks that way: function filter_ptags_on_images($content) { $content = preg_replace(‘/<p>\s*(<a .*>)?\s*(<img .* \/>)\s*(<\/a>)?\s*<\/p>/iU’, ‘\1\2\3’, $content); return preg_replace(‘/<p>\s*(<iframe .*>*.<\/iframe>)\s*<\/p>/iU’, ‘\1’, $content); } add_filter(‘acf_the_content’, ‘filter_ptags_on_images’);
I assume you are using the text editor… The example with the blank line in your question would normally be converted by WP to this: <ol> <li>Paragraph 1 : text <p> Some more text</p></li> <li>…</li> </ol> Wpautop wraps the 2nd line with the p element because of the blank line you created. Your example of … Read more
Not sure exactly how you are adding the editor but with wp_editor() the first parameter is the default content. Codex reference: https://codex.wordpress.org/Function_Reference/wp_editor
Why you are not using table? Spaces are ridiculus. On WYSIWYG editor select table with 2 columns and 3 rows, align items in left column to left, and in right to center and everything should work fine. EDIT. Ok, I see where is the problem. TinyMCE (WYSIWYG editor) has table option, but by default it … Read more
I got it fixed with below code 🙂 $section_content = get_sub_field(‘section_content’, false, false); $section_content = apply_filters(‘the_content’, $section_content);
If there’s a bug the Visual tab would just not work, not be missing. The editor scripts would also be failing to load, not missing from load-scripts.php. That the tabs are missing and the script isn’t being loaded suggests that the Visual editor has simply been disabled in your profile (Users > Your Profile).
This has solved the problem, simply remove the plugin which automatically formats text as you type, from loading in the first place. add_filter( ‘tiny_mce_plugins’, ‘rwebster_editor_remove_wptextpattern’, 1, 99 ); function rwebster_editor_remove_wptextpattern( $plugins ) { $wptextpattern = array_search( ‘wptextpattern’, $plugins ); unset( $plugins[$wptextpattern] ); return $plugins; }
Yes using the built in editor is the right way to do it. WordPress prizes backwards compatibility so the function should continue to work forever.