Fatal error: Uncaught Error: Cannot use object of type WP_Error as array
-
Hi!, My website was working fine until today where everything screwed up. I didn’t touch anything and I’m getting the following error:
Fatal error: Uncaught Error: Cannot use object of type WP_Error as array in /home/c1520738/public_html/wp-content/plugins/insert-php/includes/shortcodes/shortcode-php.php(52) : eval()'d code:9 Stack trace: #0 /home/c1520738/public_html/wp-content/plugins/insert-php/includes/shortcodes/shortcode-php.php(52): eval() #1 /home/c1520738/public_html/wp-content/plugins/insert-php/libs/factory/shortcodes/shortcode.class.php(287): WINP_SnippetShortcodePhp->html(Array, '', 'wbcr_php_snippe...') #2 /home/c1520738/public_html/wp-content/plugins/insert-php/libs/factory/shortcodes/shortcodes.php(96): Wbcr_FactoryShortcodes325_Shortcode->render(Array, '', 'wbcr_php_snippe...') #3 /home/c1520738/public_html/wp-includes/shortcodes.php(325): Wbcr_FactoryShortcodes325_ShortcodeManager->__call('shortcode_WINP_...', Array) #4 [internal function]: do_shortcode_tag(Array) #5 /home/c1520738/public_html/wp-includes/shortcodes.php(199): preg_replace_callback('/\\[(\\[?)(wbcr_p...', 'do_shortcode_ta...', '[wbcr_php_snipp...') #6 /home/c1520738/publ in /home/c1520738/public_html/wp-content/plugins/insert-php/includes/shortcodes/shortcode-php.php(52) : eval()'d code on line 9And this is the code on shortcode-php.php
<?php /** * Php Shortcode */ // Exit if accessed directly if (!defined('ABSPATH')) { exit; } class WINP_SnippetShortcodePhp extends WINP_SnippetShortcode { public $shortcode_name = 'wbcr_php_snippet'; /** * Content render * * @param array $attr * @param string $content * @param string $tag */ public function html( $attr, $content, $tag ) { $id = $this->getSnippetId( $attr, WINP_SNIPPET_TYPE_PHP ); if ( ! $id ) { echo '<span style="color:red">' . __( '[' . esc_html( $tag ) . ']: PHP snippets error (not passed the snippet ID)', 'insert-php' ) . '</span>'; return; } $snippet = get_post( $id ); $snippet_meta = get_post_meta( $id, '' ); if ( ! $snippet || empty( $snippet_meta ) ) { return; } $attr = $this->filterAttributes( $attr, $id ); // Let users pass arbitrary variables, through shortcode attributes. // @since 2.0.5 extract( $attr, EXTR_SKIP ); $is_activate = $this->getSnippetActivate( $snippet_meta ); $snippet_scope = $this->getSnippetScope( $snippet_meta ); $snippet_content = $this->getSnippetContent( $snippet, $snippet_meta, $id ); if ( ! $is_activate || empty( $snippet_content ) || $snippet_scope != 'shortcode' || WINP_Helper::is_safe_mode() ) { return; } eval( $snippet_content ); } }If I deactivate the plugin, the error dissapear but non of my snippets will work (obviously) but I really need those snippets. Any help would be appreciate. Thanks!
The topic ‘Fatal error: Uncaught Error: Cannot use object of type WP_Error as array’ is closed to new replies.