How To Hide The Visual And Html Editor Completely?

For posts: add_action(‘init’, ‘my_custom_init’); function my_custom_init() { remove_post_type_support( ‘post’, ‘editor’ ); } See Codex. For custom post types that you register, you can specify what ‘features’ it supports when you register it it use the ‘supports’ arguments. For custom post types that are not registered by you can use the above with ‘post’ replaced by … Read more

Exclude file from theme editor

In general I wouldn’t recommend editing files that way and just disable it with the well known DISALLOW_FILE_EDIT or DISALLOW_FILE_MODS constants, that are checked within the map_meta_cap() function. But anyway it’s interesting to see if we can find a way to exclude files from the theme editor. Here are some ideas: There doesn’t seem to … Read more

How-to stop wordpress from saving utf8 non-breaking space characters

Both initial creation and updates for the posts pass through wp_insert_post_data (among other filters). You can modify post_content item in array passed to make the replacement you need, before it proceeds on to be saved in database. Update Code pasted from comments add_filter( ‘wp_insert_post_data’, ‘rm_wp_insert_post_data’, ’99’, 2 ); function rm_wp_insert_post_data ( $data , $postarr ) … Read more

Why does the custom HTML block not preserve the HTML characters?

This is caused by wptexturize and the use of a standard <div> to contain your code. See https://developer.wordpress.org/reference/functions/wptexturize/ Instead, markup code as code: Text enclosed in the tags <pre>, <code>, <kbd>, <style>, <script>, and <tt> will be skipped. This list of tags can be changed with the no_texturize_tags filter. Note that the HTML block just … Read more

How to make WordPress and TinyMCE accept tags wrapping block-level elements as allowed in HTML5?

[*] A few years down the track, but hopefully someone else will find this solution useful… Although my issues trying to get this sort of thing to work in WordPress were slightly different, hopefully this solution will work for you too. Firstly, the issue with tags not being allowed to contain multiple block level elements … Read more

data-accordion removed in Visual Editor

Here is an example of How to Update kses and TinyMCE to allow select data-* attributes in WordPress. Reference add_action( ‘after_setup_theme’, ‘x_kses_allow_data_attributes_on_links’ ); function x_kses_allow_data_attributes_on_links() { global $allowedposttags; $tags = array( ‘a’ ); $new_attributes = array( ‘data-foo’ => array(), ‘data-bar’ => array(), ); foreach ( $tags as $tag ) { if ( isset( $allowedposttags[ $tag … Read more

how to make stylesheet appear in theme editor?

I’d say it’s impossible… For one, there’s no hook inside the file /wp-admin/theme-editor.php. And last but not least, if you try one of this, it dumps an error: /wp-admin/theme-editor.php?file=css%2Fstyle.css&theme=twentyeleven /wp-admin/theme-editor.php?file=css/style.css&theme=twentyeleven Case you find a workaround, this code injects a link to the desired file: /** * Adjust the if(‘Twenty Eleven’ == sel) to your theme … Read more

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