rankmath / seo-by-rank-math

Rank Math is a revolutionary WordPress SEO Plugin that combines the features of many SEO tools and lets you multiply your traffic in the easiest way possible :bulb: :chart_with_upwards_trend: →
https://rankmath.com
107 stars 52 forks source link

wp_editor() conflict when meta description field is set to default #277

Open maurisrx opened 5 months ago

maurisrx commented 5 months ago

Describe the bug Having wp_editor() editor form on the front end when using default description meta causes admin bar icon not loading. It also cause conflict with some plugins.

To Reproduce Steps to reproduce the behavior:

  1. Log in as an administrator.

  2. Activate only Rank Math plugin and deactivate other plugins.

  3. Activate storefront theme.

  4. To add wp_editor() instance on front end, add the following snippet to add tinymce editor to a frontend content. It can be added via code snippets plugin or active theme’s functions.php:

    add_filter( 'the_content', function( $content ) {
    ob_start();
    
    $content   = '';
    $editor_id = 'test';
    $settings  = array(
    'media_buttons' => false,
    'textarea_rows' => 10,
     'required'      => 'required',
    'quicktags'     => false,
    );
    
    wp_editor( $content, $editor_id, $settings );
    
    return $content . ob_get_clean();
    } );
  5. Visit any WP post on frontend.

  6. Check the icons on the WP admin toolbar and they will not load properly.

    Screenshot 2024-05-03 at 10 56 14
  7. This also cause conflicts with other plugins that add wp_editor() instance on the frontend.

  8. Oddly if I set custom meta description field such as Test via menu Rank Math SEO > Titles & Meta > Post Types > Post instead of the default %excerpt%, it fixes the issue.

Expected behavior The icons load normally.

Desktop (please complete the following information):