TinyMCE not loading in IE8

The hook admin_init is to early for dequeuing, use wp_print_scripts, see examples in the Codex. define( ‘SCRIPT_DEBUG’, true ); will prevent combining dashboard scripts, so if that works for you on IE8, then do it for users with IE8: /** * True if user browser is IE8. */ $is_IE8 = preg_match( ‘/(?i)msie 8/’, $_SERVER[‘HTTP_USER_AGENT’] ); … Read more

Stop editor from adding “amp;” after every “&”

One solution is to hook into wp_insert_post_data and do some regex magic to replace all instances of & with &: // when saving posts, replace & with & function cc_wpse_264548_unamp( $data ) { $data[‘post_content’] = preg_replace( “/&/”, // find ‘&’ “&”, // replace with ‘&’ $data[‘post_content’] // target the ‘post_content’ ); return $data; } add_filter( … Read more

How to add custom tinymce plugin to new text widget

I found the solution with help from Jacob Peattie and the article from https://make.wordpress.org/core/2017/05/23/addition-of-tinymce-to-the-text-widget/ Here’s a quick walkthrough on what i did: I made a new js file container the code of my original button, but modified it to the event listener of the widget tinymce jQuery( document ).on( ‘tinymce-editor-setup’, function( event, editor ) { … Read more

Adding to the WYSIWYG

TinyMCE has a ‘formats’ dropdown that you can add options to: This option enables you to add more advanced style formats for text and other elements to the editor. The value of this option will be rendered as styles in the styleselect dropdown toolbar item. https://www.tinymce.com/docs/configure/content-formatting/#style_formats The first thing you need to do is add … Read more

Extract links from content

I thought regex search may become critical so html dom parser may help. See the code below (if it helps): <?php $post_content = get_the_content(); $dom = new DomDocument(); $dom->loadHTML($post_content); foreach ($dom->getElementsByTagName(‘a’) as $item) { echo “<a href=”https://wordpress.stackexchange.com/questions/315648/.$item->getAttribute(“href’).” target=”_blank” rel=””. $item->getAttribute(“rel’) .”‘>”. $item->getAttribute(‘title’) .”</a><br />”; } ?>

WordPress’s “Text” Format

Text its just plain text, just as its saved in your db. WordPress changes line breaks with paragraphs with the function wpautop, through the filter the_content and the_excerpt. If you need to remove the wpautop behavior, you can remove the filter by doing this in your theme’s functions.php: remove_filter( ‘the_content’, ‘wpautop’ ); remove_filter( ‘the_excerpt’, ‘wpautop’ … Read more

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