skip to Main Content

I have a question about a WordPress URL in Google Chrome 94.0.4606.81:

I was reading a WordPress article recently and noticed that there is an  (OBJ) symbol in the URL. The symbol is also in the webpage title.

Take Ownership and Select Owner


Question:

What is the purpose of the  (OBJ) symbol — and how is it possible that it has been included in a URL?

4

Answers


  1. It seems like you got this symbol in the title field of the article. You can remove it from there. If you don’t see it select everything in the field with ctrl + a and write the title new.

    Login or Signup to reply.
  2. Honestly, I don’t know what nature is this copy/paste issue in WP, and the "Object Replacement Character"

    To avoid appearing this character it’s enough to use Ctrl+Shift+V shortcut while pasting into WP post title field, means: Paste Text Without Formatting.

    If you want to be sure in protecting the post slug (means: post URL) you can use the snippet in your functions.php:

    /**
     * Remove the strange [OBJ] character in the post slug
     * See: https://github.com/WordPress/gutenberg/issues/38637
     */
    add_filter("wp_unique_post_slug", function($slug, $post_ID, $post_status, $post_type, $post_parent, $original_slug) {
        return preg_replace('/(%ef%bf%bc)|(efbfbc)|[^w-]/', '', $slug);
    }, 10, 6);
    

    preg_replace function searches here for string "%ef%bf%bc" or "efbfbc" (UTF-8 – hex encoded OBJ character) OR any character that IS NOT base alphanumeric character or dash character – to delete.

    Login or Signup to reply.
  3. Since you’ve mentioned it also made into the title: I use this to filter the title on save to remove these special characters.

    function sbnc_filter_title($title) {
    
        // Concatenate separate diacritics into one character if we can
        if ( function_exists('normalizer_normalize') && strlen( normalizer_normalize( $title ) ) < strlen( $title ) ) {
            $title = normalizer_normalize( $title );
        }
    
        // Replace no-break-space with regular space
        $title = preg_replace( '/x{00A0}/u', ' ', $title );
        
        // Remove whitespaces from the ends
        $title = trim($title);
    
        // Remove any invisible and control characters
        $title = preg_replace('/[^x{0020}-x{007e}x{00a1}-x{FFEF}]/u', '', $title);
    
        return $title;
    }
    add_filter('title_save_pre', 'sbnc_filter_title');
    

    Please note that you may need to extend set of allowed UTF range in the preg_replace call based on the languages you support. The range in the example should suit most languages actively used in the word, but if you may write article titles that include archaic scripts like Linear-B, gothic etc. you may need to extend the ranges.

    Login or Signup to reply.
  4. If you copy-pasted it from somewhere, like I did, remember to paste as text using Ctrl + Shift + V to avoid this.

    Also, it is the case that this [OBJ] only appears in Chromium-based browsers like Chrome, Edge etc, unlike in Firefox which I believe discards it by default.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search