• Resolved indalia

    (@indalia)


    Error showing at the top of the site today, and couldn’t log into wordpress. Manually disabled the plugin and all is well. Here’s the error to help with the bug:

    Warning: array_intersect(): Expected parameter 2 to be an array, null given in /home/customer/www/oursite.com/public_html/wp-content/plugins/page-or-post-clone/page-or-post-clone.php on line 123

Viewing 9 replies - 1 through 9 (of 9 total)
  • Hi @indalia,

    How did you mannually disable? I have renamed the plugin folder and also gone through myphp but no luck ??

    • This reply was modified 2 years, 10 months ago by benooh.
    Thread Starter indalia

    (@indalia)

    @benooh I renamed the plugin folder via FTP…that should work?

    Ahh, yes it worked. Just needed a while for caching. Thanks for the help!

    Anonymous User 15391246

    (@anonymized-15391246)

    Came here to submit a report and saw that @indalia already did so. We had to remove this plugin from almost 20 sites earlier. This is/was the best plugin for cloning. We will have to use something else until this gets fixed.

    We got the “critical error” message on all sites. once we removed the plugin, everything was good to go.

    For Anyone having this issue, go and edit the plugin itself and starting at line 121 to 134 replace what exists with the following code

    add_action('init', function(){
      global $current_user;
      $allowed_roles = array('editor', 'administrator', 'author');
      if (array_intersect($allowed_roles, $current_user->roles)) {
    
          function content_clone_link($actions, $post)
          {
              if (current_user_can('edit_posts')) {
                  $actions['duplicate'] = '<a href="' . wp_nonce_url('admin.php?action=content_clone&post=' . $post->ID, basename(__FILE__), 'clone_nonce') . '" title="Clone!" rel="permalink">Clone</a>';
              }
              return $actions;
          }
      }
      add_filter('post_row_actions', 'content_clone_link', 10, 2); // Para artigos
      add_filter('page_row_actions', 'content_clone_link', 10, 2); //Para páginas
    });

    This takes puts this in an init hook so that there is access to the $current_user global variable

    @drummerchas, @benooh, @indalia – See above

    After replacing the code as shown by @johannawebvolta, the site was still showing the error. After spending another half hour searching for solutions, I logged into the web host and flushed the site’s cache. THEN WordPress loaded the new code and it worked. Without manually flushing the cache it might have taken several hours for the change to be visible. Having this plugin break the client’s site leads me to think that the best thing to do is to uninstall the plugin and only reinstall it temporarily while editing pages or posts that I need to clone, then uninstall when finished.

    Anonymous User 15391246

    (@anonymized-15391246)

    Thank you for your input, @johannawebvolta. It worked perfectly.

    @netgainassociates I would guess that caching would’ve caused the issue to not resolve for you.

    Tried and tested in a few environments and all works fine. If you need the complete file, I’d be happy to supply.

    Plugin Author carlosfazenda

    (@carlosfazenda)

    @johannawebvolta @drummerchas @netgainassociates @benooh @indalia

    Thank you all for reaching back. All is working now, so please update to the last version of the plugin.

    If you find it useful, please consider to make a donation at https://www.paypal.me/carlosfazenda/10

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Latest update broke it’ is closed to new replies.