Possible To Disable Insert Image / Link?
Quote from hauntedpixel on December 10, 2017, 8:38 pmIs there a way to prevent users from inserting images or inserting links? A way to remove the option entirely from the toolbar when posting.
Is there a way to prevent users from inserting images or inserting links? A way to remove the option entirely from the toolbar when posting.
Quote from Asgaros on December 11, 2017, 10:43 amHello hauntedpixel,
please add the following code to your themes functions.php file to remove the buttons for links and images:
function myplugin_tinymce_buttons( $buttons ) { $remove1 = 'image'; $remove2 = 'link'; if (($key = array_search($remove1, $buttons)) !== false) { unset($buttons[$key]); } if (($key = array_search($remove2, $buttons)) !== false) { unset($buttons[$key]); } return $buttons; } add_filter('mce_buttons', 'myplugin_tinymce_buttons', 10000, 2); add_filter('teeny_mce_buttons', 'myplugin_tinymce_buttons', 10000, 2);
Hello hauntedpixel,
please add the following code to your themes functions.php file to remove the buttons for links and images:
function myplugin_tinymce_buttons( $buttons ) { $remove1 = 'image'; $remove2 = 'link'; if (($key = array_search($remove1, $buttons)) !== false) { unset($buttons[$key]); } if (($key = array_search($remove2, $buttons)) !== false) { unset($buttons[$key]); } return $buttons; } add_filter('mce_buttons', 'myplugin_tinymce_buttons', 10000, 2); add_filter('teeny_mce_buttons', 'myplugin_tinymce_buttons', 10000, 2);
Quote from hauntedpixel on December 11, 2017, 2:25 pmMuch appreciated. Thank you!
Much appreciated. Thank you!
Quote from Olli on March 16, 2018, 9:20 pmHi,thank you for this code, it works 😉But if i update my theme i have to insert the code again, is there any possibility to save this code at the functions.php so that i must not insert it again?
Is there a possibility that you implement a function to the forum so that i can disallow it from the config directly?
Regards
OlliQuote from Asgaros on December 11, 2017, 10:43 amHello hauntedpixel,
please add the following code to your themes functions.php file to remove the buttons for links and images:
function myplugin_tinymce_buttons( $buttons ) { $remove1 = 'image'; $remove2 = 'link'; if (($key = array_search($remove1, $buttons)) !== false) { unset($buttons[$key]); } if (($key = array_search($remove2, $buttons)) !== false) { unset($buttons[$key]); } return $buttons; } add_filter('mce_buttons', 'myplugin_tinymce_buttons', 10000, 2); add_filter('teeny_mce_buttons', 'myplugin_tinymce_buttons', 10000, 2);
- function myplugin_tinymce_buttons( $buttons ) {
- $remove1 = ‘image’;
- $remove2 = ‘link’;
- if (($key = array_search($remove1, $buttons)) !== false) {
- unset($buttons[$key]);
- }
- if (($key = array_search($remove2, $buttons)) !== false) {
- unset($buttons[$key]);
- }
- return $buttons;
- }
- add_filter(‘mce_buttons’, ‘myplugin_tinymce_buttons’, 10000, 2);
- add_filter(‘teeny_mce_buttons’, ‘myplugin_tinymce_buttons’, 10000, 2);
function myplugin_tinymce_buttons( $buttons ) { $remove1 = 'image'; $remove2 = 'link'; if (($key = array_search($remove1, $buttons)) !== false) { unset($buttons[$key]); } if (($key = array_search($remove2, $buttons)) !== false) { unset($buttons[$key]); } return $buttons; } add_filter('mce_buttons', 'myplugin_tinymce_buttons', 10000, 2); add_filter('teeny_mce_buttons', 'myplugin_tinymce_buttons', 10000, 2);
Hi,thank you for this code, it works 😉But if i update my theme i have to insert the code again, is there any possibility to save this code at the functions.php so that i must not insert it again?
Is there a possibility that you implement a function to the forum so that i can disallow it from the config directly?
Regards
Olli
Quote from Asgaros on December 11, 2017, 10:43 amHello hauntedpixel,
please add the following code to your themes functions.php file to remove the buttons for links and images:
function myplugin_tinymce_buttons( $buttons ) { $remove1 = 'image'; $remove2 = 'link'; if (($key = array_search($remove1, $buttons)) !== false) { unset($buttons[$key]); } if (($key = array_search($remove2, $buttons)) !== false) { unset($buttons[$key]); } return $buttons; } add_filter('mce_buttons', 'myplugin_tinymce_buttons', 10000, 2); add_filter('teeny_mce_buttons', 'myplugin_tinymce_buttons', 10000, 2);
- function myplugin_tinymce_buttons( $buttons ) {
- $remove1 = ‘image’;
- $remove2 = ‘link’;
- if (($key = array_search($remove1, $buttons)) !== false) {
- unset($buttons[$key]);
- }
- if (($key = array_search($remove2, $buttons)) !== false) {
- unset($buttons[$key]);
- }
- return $buttons;
- }
- add_filter(‘mce_buttons’, ‘myplugin_tinymce_buttons’, 10000, 2);
- add_filter(‘teeny_mce_buttons’, ‘myplugin_tinymce_buttons’, 10000, 2);
function myplugin_tinymce_buttons( $buttons ) { $remove1 = 'image'; $remove2 = 'link'; if (($key = array_search($remove1, $buttons)) !== false) { unset($buttons[$key]); } if (($key = array_search($remove2, $buttons)) !== false) { unset($buttons[$key]); } return $buttons; } add_filter('mce_buttons', 'myplugin_tinymce_buttons', 10000, 2); add_filter('teeny_mce_buttons', 'myplugin_tinymce_buttons', 10000, 2);
Quote from Asgaros on April 3, 2018, 9:52 amHello @olli
In your case it would be the best to put the code in an own custom plugin-file. Here you can find an tutorial:
http://webcraft.tools/how-to-create-a-simple-wordpress-plugin/
Hello @olli
In your case it would be the best to put the code in an own custom plugin-file. Here you can find an tutorial:
Quote from Alcandau on October 25, 2019, 3:20 pmHello @asgaros
In my case the code does not work. Instead, it adds a clickable zone (same target than the image) closed to the image :
My image in a topic is left aligned, then all the zone at its right get clickable. And the image itself remains clickable also.
Would you see why ?
Thank you
Hello @asgaros
In my case the code does not work. Instead, it adds a clickable zone (same target than the image) closed to the image :
My image in a topic is left aligned, then all the zone at its right get clickable. And the image itself remains clickable also.
Would you see why ?
Thank you
Quote from Asgaros on October 26, 2019, 12:17 pmHello @alcandau
This code does not have any effect on links/images which are already included inside of posts. Uploaded images via the upload-functionality will also work as before – so if you want to remove them, you have to disable the upload-functionality as well.
Hello @alcandau
This code does not have any effect on links/images which are already included inside of posts. Uploaded images via the upload-functionality will also work as before – so if you want to remove them, you have to disable the upload-functionality as well.