WP Editor strips input placeholder attribute

The list of allowed elements and attributes is stored in the global variable $allowedposttags which is set in wp-includes/kses.php. To override it create a simple mu plugin with the following content: <?php # -*- coding: utf-8 -*- /** * Plugin Name: Enable placeholder attribute for input elements in post tags. * Version: 2012.07.18 */ add_action( … Read more

Preserve white-space in Page

You are not wrapping the code inside <code> tags. <pre> <code> selector { property: value; property: value; } </code> </pre> Furthermore, most syntax highlighting plugins also use this format (both <pre> and <code>) to render code. Here you have more about this. https://css-tricks.com/snippets/css/make-pre-text-wrap/

Where can I find the code how wordpress parses a post?

The specific function you are referring to is wpautop, which adds paragraphs & HTML linebreaks to already intermixed HTML & plain text. wpautop is part of a family of content-processing functions hooked to the_content, a filter applied to the post content after pulling from the database just before outputting. Taking a look at wp-includes/default-filters.php, you … Read more

strip only specific tags (like ), but keep other tags (like )

You’d better never disable those actions (what you say). Instead, insert add_filter(‘the_content’, ‘MyFilter’, 88 ); and create such function: function MyFilter($content){ $tags = array( ‘p’, ‘span’); /////////////////////////////////////////////////// ///////// HERE INSERT ANY OF BELOW CODE ////////// /////////////////////////////////////////////////// return $content; } ======== METHOD 1 ========= $content= preg_replace( ‘#<(‘ . implode( ‘|’, $tags) . ‘)(.*|)?>#si’, ”, $content); $content= … Read more

Removing buttons from the html editor

With the quicktag_settings filter: function wpa_47010( $qtInit ) { $qtInit[‘buttons’] = ‘strong,em,link,block,del,img,ul,ol,li,code,more,spell,close,fullscreen’; return $qtInit; } add_filter(‘quicktags_settings’, ‘wpa_47010’); The default is: $qtInit[‘buttons’] = ‘strong,em,link,block,del,ins,img,ul,ol,li,code,more,spell,close’; Though ‘fullscreen’ usually gets added too at the end. So I just deleted the ‘ins’ button. Edit to add: If you wish to create a custom button the following tutorial might help.

serialize_blocks breaking html tags in content

This happens in serialize_block_attributes, the docblock explains why: /** … * The serialized result is a JSON-encoded string, with unicode escape sequence * substitution for characters which might otherwise interfere with embedding * the result in an HTML comment. … */ So this is done as an encoding measure to avoid attributes accidentally closing a … Read more

How to to stop html editor from addig tags to shortcodes, images, etc

1. Filtering the content Here’s a one-function content filter to meet the above four requirements: add_filter( ‘the_content’, ‘strip_some_paragraphs’, 20 ); function strip_some_paragraphs( $content ) { $content = preg_replace( ‘/<p>(([\s]*)|[\s]*(<img[^>]*>|\[[^\]]*\])[\s]*)<\/p>/’, ‘$3’, $content ); return $content; } 2. Resources for Regular Expressions regular-expressions.info – Manual, Basic & Advanced Tutorials regexpal.com – on the fly regex tester, very … Read more

Enable / Add Custom Keyboard Shortcuts To Work With WordPress’ HTML Editor

The toolbar / editor used on Stack Exchange websites (and in my plug-in WP-MarkDown) is PageDown. This comes with three JavaScript files: One that handles MarkDown to HTML conversion One that handles sanitization One that handles the editor (the toolbar and previewer) Included in the latter are the MarkDown keyboard shortcuts you mentioned. The following … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)