EnlighterJS / Plugin.WordPress

:package: Official WordPress Plugin of EnlighterJS
http://wordpress.org/plugins/enlighter/
GNU General Public License v2.0
115 stars 17 forks source link

PHP apostrophes get changed #353

Closed technoogies closed 2 years ago

technoogies commented 2 years ago

Howdy, When I use Enlighter to post PHP code the apostrophes get converted into single right quotes on the frontend, but I've noticed that the native word press code block does the same thing. I don't know if something can be done to stop it from doing that but it sure would be helpful if it could, 'cuz when people copy the code and try to run it fails on them. Thanks for looking at it,

AndiDittrich commented 2 years ago

could you please provide more details ? (example code, editing method, link to a test page)

technoogies commented 2 years ago

My last post: https://technoogies.com/houzz-icon-for-blocksy-theme-socials-block/

On the backend it is okay. IDK github removes SVG tags, so that is not in the code example from the backend, but the remaining apostrophes are apostrophes.

// -[ Houzz Icon for Blocksy Socials ]-
// - Houzz Blue = #0066c3
add_filter('blocksy:social-box:dynamic-social-networks', function ($networks) {
  $networks[] = [
    'id' => 'houzz',
    'name' => __('Houzz', 'blocksy'),
    'icon' => ' <svg
      class="ct-icon"
      width="20px"
      height="20px"
      viewBox="0 0 54 60">
      <polygon points="34 60 54 60 54 25.5 14 14 14 0 0 0 0 60 20 60 20 40 34 40 34 60"/>
    </svg>',
  ];

  return $networks;
});

edit: just put your code into a codeblock

AndiDittrich commented 2 years ago

i've tried to reproduce you issue but with wp 6.0 and the current Enlighter release, using the Gutenberg editor everything works as expected - no characters are modified.

i would assume that's some kind of "fancy" theme filter in place. try another theme and may disable all other plugins to identify the root cause

technoogies commented 2 years ago

The theme is Astra, but I wouldn't doubt that another plugin is effecting it since it happens in the native WP code block. I'll copy the site to staging and test it out. I'll let you know what I find.

technoogies commented 2 years ago

The plugin Better Links Pro is the problem, but not the base plugin on WordPress.org, only the Pro addon. Thanks for checking.