Console Error during importing of recommended plugins.
-
main.js?ver=3.1.1:555 Uncaught TypeError: Cannot read properties of undefined (reading 'indexOf') at Object.<anonymous> (main.js?ver=3.1.1:555:32) at c (load-scripts.php?c=1…ils&ver=6.0:2:28327) at Object.fireWith [as resolveWith] (load-scripts.php?c=1…ils&ver=6.0:2:29072) at l (load-scripts.php?c=1…ils&ver=6.0:2:79901) at XMLHttpRequest.<anonymous> (load-scripts.php?c=1…ils&ver=6.0:2:82355)
My current work around for this refreshing the page and clicking Continue & Import until it completes, I’d love to know if I formatted something wrong or if the issue lies with plugin.
I have no issues importing the XML, Widgets, and customizer settings. 🤷♂️
The page I need help with: [log in to see the link]
-
Hi Eric,
the code in question refers to the plugin install AJAX call and it looks like it’s failing for you and so the
response.data
is undefined for some reason.Could you please reproduce this and have the browser console’s “network” tab opened when you do it (filter to only see the “Fetch/XHR” requests). Once the error pops up in the console, please take a look at the last AJAX call and see what the response is. Please share the response here, so we can see what the issue might be. Also, please let us know which plugin fails to install? Does this happen for all plugins or just certain ones?
Take care!
The response is a 302 redirect
It appears to happen on
'slug' => 'wp-svg-images',
and'slug' => 'wordpress-seo',
Hi Eric,
could you please share your whole
ocdi/register_plugins
callback, if possible? I mean the entire list of your required plugins, so I can test it out and see if I get the same issue. Because the two plugins you mentioned above are both available publicly on wordpress.org, so it’s strange they would cause issues.Thanks!
<?php /* Plugin Name: Ascend Theme Import Settings Plugin URI: https://ascendtheme.com/ Description: Auto Import Settings for Ascend theme, works with OCDI Version: 3.1.1 Author: Eric Johnson Author URI: https://ericjohnson.guru/ License: GPLv2 License URI: https://www.gnu.org/licenses/old-licenses/gpl-2.0.en.html */ function ocdi_register_plugins($plugins) { $theme_plugins = [ [ 'name' => 'Code Snippets', // Name of the plugin. 'slug' => 'code-snippets', // Plugin slug - the same as on WordPress.org plugin repository. 'required' => true, // If the plugin is required or not. 'preselected' => true, ], [ 'name' => 'Generate Blocks', // Name of the plugin. 'slug' => 'generateblocks', // Plugin slug - the same as on WordPress.org plugin repository. 'required' => true, // If the plugin is required or not. 'preselected' => true, ], [ 'name' => 'Yoast Duplicate Post', // Name of the plugin. 'slug' => 'duplicate-post', // Plugin slug - the same as on WordPress.org plugin repository. 'required' => false, // If the plugin is required or not. 'preselected' => true, ], [ 'name' => 'Yoast SEO', // Name of the plugin. 'slug' => 'wordpress-seo', // Plugin slug - the same as on WordPress.org plugin repository. 'required' => true, // If the plugin is required or not. 'preselected' => true, ], [ 'name' => 'WP Recipe Maker', // Name of the plugin. 'slug' => 'wp-recipe-maker', // Plugin slug - the same as on WordPress.org plugin repository. 'required' => false, // If the plugin is required or not. 'preselected' => true, ], [ 'name' => 'Grow Social', // Name of the plugin. 'slug' => 'social-pug', // Plugin slug - the same as on WordPress.org plugin repository. 'required' => false, // If the plugin is required or not. 'preselected' => true, ], [ 'name' => 'Admin color Schemes, a nice way to add more colors to the admin.', // Name of the plugin. 'slug' => 'admin-color-schemes', // Plugin slug - the same as on WordPress.org plugin repository. 'required' => false, // If the plugin is required or not. 'preselected' => true, ], [ 'name' => 'WP SVG images - Add SVG support to your WordPress', // Name of the plugin. 'slug' => 'wp-svg-images', // Plugin slug - the same as on WordPress.org plugin repository. 'required' => false, // If the plugin is required or not. 'preselected' => true, ], [ 'name' => 'Regenerate Thumbnails', // Name of the plugin. 'slug' => 'regenerate-thumbnails', // Plugin slug - the same as on WordPress.org plugin repository. 'required' => false, // If the plugin is required or not. 'preselected' => true, ], [ 'name' => 'generateblocks pro', 'description' => 'Premium Version of Generate Blocks YOU NEED A LICENCE', 'slug' => 'generateblocks-pro', // The slug has to match the extracted folder from the zip. 'source' => 'HIDDEN', 'preselected' => true, ], // [ // 'name' => 'Generate Press Premium', // 'description' => 'Premium Version of Generate Press YOU NEED A LICENCE', // 'slug' => 'gp-premium', // The slug has to match the extracted folder from the zip. // 'source' => 'HIDDEN', // 'required' => true, // If the plugin is required or not. // 'preselected' => true, // ], ]; return array_merge($plugins, $theme_plugins); } add_filter('ocdi/register_plugins', 'ocdi_register_plugins'); function ocdi_import_files() { return [ [ 'import_file_name' => 'Ascend Theme', 'import_file_url' => 'https://ascendtheme.com/files/2022-06-22-ascendthemecom.WordPress.xml', 'import_widget_file_url' => 'https://ascendtheme.com/files/2022-06-22-ascendtheme.com-widgets.wie', 'import_customizer_file_url' => 'https://ascendtheme.com/files/2022-06-22-generatepress-export-customizer.dat', 'import_preview_image_url' => 'https://ascendtheme.com/wp-content/uploads/2022/01/AscendThemePreview.png', 'preview_url' => 'https://ascendtheme.com/', ], ]; } add_filter('ocdi/import_files', 'ocdi_import_files');
-
This reply was modified 2 years, 10 months ago by
EricJohnsonGuru.
Hello, any thoughts?
Hi @wormeyman,
sorry about the delay, I didn’t get a notification from your previous message.
I think the issue is with some plugins having a request redirect. For example this plugin “GenerateBlocks”. When its activated for the first time, it will steal whatever the next admin request will be and it will display their “admin lading page”.
That’s what is causing issues for your next plugin installs. They fail, because the plugins are stealing request after they are activated.
You’ll have to find a way to disable those “auto-redirects after first activation” for those plugins that do that and then the install process will work OK. Some plugins have WP options that can be set to skip such redirect, but each plugin is different. So maybe contacting them with a question on how to do that, would be best.
Take care!
For those wondering what the answer to generate blocks is the code is:
add_filter( 'generateblocks_do_activation_redirect', '__return_false' );
Hi Eric,
thank you for sharing this with us.
Have a nice day!
-
This reply was modified 2 years, 10 months ago by
- The topic ‘Console Error during importing of recommended plugins.’ is closed to new replies.