• Resolved moxymore

    (@moxymore)


    Hi,

    I’m a french guy, so my labels can contain some apostrophes, like “Domaines d’activité”. Try to add such labels and you will see that the output will be encoded html entities. I had to fix this by adding this filter :

    add_filter('register_post_type_args', 'fix_cpt_labels_apostrophe', 10, 2);
    function fix_cpt_labels_apostrophe($args, $post_type) {
    if (!empty($args['labels'])) {
    foreach ($args['labels'] as $key => $label) {
    $args['labels'][$key] = html_entity_decode($label);
    }
    }

    return $args;
    }

    I’m sure you can do it in your plugin’s code in order for us to don’t apply it manually.

    You’re welcome. Regards.

    • This topic was modified 1 month, 4 weeks ago by moxymore.
    • This topic was modified 1 month, 4 weeks ago by moxymore.
Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Contributor Michael Beckwith

    (@tw2113)

    The BenchPresser

    hi @moxymore

    Thank you for your patience.

    Which field are you adding these to that are resulting in HTML encoded versions? Asking because I know we’ve overall dealt with this before, and I’m not managing to recreate, at least with the “Menu Name” field.

    Screen Shot

    See both upper corners in the screenshot, at least for the handling on CPTUI’s side of things.

    If we know it’s happening with a specific label field, we can look into a bit closer.

    Plugin Contributor Michael Beckwith

    (@tw2113)

    The BenchPresser

    @moxymore any changes or thoughts regarding my comment above?

    Thread Starter moxymore

    (@moxymore)

    Hi,
    This happens in the Gutenberg editor, in the right sidebar.
    Screenshot : https://imgur.com/a/3AVGkhB


    If I add any type of filters, like register_post_type_args or post_type_labels_mycptslug, the issue disapears. It’s probably something related with JSON and the gutenberg editor.

    The related field seems to be $labels->singular_name

    • This reply was modified 1 month, 2 weeks ago by moxymore.
    • This reply was modified 1 month, 2 weeks ago by moxymore.
    • This reply was modified 1 month, 2 weeks ago by moxymore.
    • This reply was modified 1 month, 2 weeks ago by moxymore.
    Plugin Contributor Michael Beckwith

    (@tw2113)

    The BenchPresser

    Hmm. I’m still not managing to recreate even when putting “Domaines d’activité” in the singular label field. Very obviously you are recreating, but something isn’t consistent and I do agree it’s probably more to do with JSON/block editor more than anything.

    CPTUI Label field:

    Screen Shot

    Block tab:

    Screen Shot

    Thread Starter moxymore

    (@moxymore)

    Well, maybe a localised issue on my end. You can close the ticket then.

    Plugin Contributor Michael Beckwith

    (@tw2113)

    The BenchPresser

    Feel free to chime back in in case you figure out anything new.

    Thanks for sticking with us here.

Viewing 6 replies - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.