Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"Content Snippet" & "Snippet Source Code" Gutenberg Blocks Error #204

Open
pauserratgutierrez opened this issue Dec 10, 2024 · 2 comments
Open
Assignees

Comments

@pauserratgutierrez
Copy link
Member

pauserratgutierrez commented Dec 10, 2024

Current behavior

The "Content Snippet" Block doesn't work and displays "This block has encountered an error and cannot be previewed.". The "Snippet Source Code" Block also fails.

Expected behavior

The blocks should work as expected without triggering any errors.

Steps to reproduce

  1. Create or edit a post/page in Gutenberg.
  2. Insert a "Content Snippet" or a "Snippet Source Code" Block.
  3. Observe the error: "This block has encountered an error and cannot be previewed."

WordPress version

6.7.1

Code Snippets version

3.6.6.1

Code Snippets license

Pro

Anything else?

Image

PHP error.log:

[10-Dec-2024 22:09:42 UTC] PHP Warning:  Undefined property: Code_Snippets\Plugin::$frontend in C:\Users\pause\Local Sites\cs-tests\app\public\wp-content\plugins\code-snippets-pro\php\front-end\class-block-editor.php on line 198
[10-Dec-2024 22:09:42 UTC] PHP Fatal error:  Uncaught Error: Call to a member function render_content_shortcode() on null in C:\Users\pause\Local Sites\cs-tests\app\public\wp-content\plugins\code-snippets-pro\php\front-end\class-block-editor.php:198
Stack trace:
#0 C:\Users\pause\Local Sites\cs-tests\app\public\wp-includes\class-wp-block.php(537): Code_Snippets\Block_Editor->render_content(Array, '', Object(WP_Block))
#1 C:\Users\pause\Local Sites\cs-tests\app\public\wp-includes\blocks.php(2190): WP_Block->render()
#2 C:\Users\pause\Local Sites\cs-tests\app\public\wp-includes\blocks.php(2242): render_block(Array)
#3 C:\Users\pause\Local Sites\cs-tests\app\public\wp-includes\class-wp-hook.php(324): do_blocks('<!-- wp:code-sn...')
#4 C:\Users\pause\Local Sites\cs-tests\app\public\wp-includes\plugin.php(205): WP_Hook->apply_filters('<!-- wp:code-sn...', Array)
#5 C:\Users\pause\Local Sites\cs-tests\app\public\wp-includes\rest-api\endpoints\class-wp-rest-revisions-controller.php(632): apply_filters('the_content', '<!-- wp:code-sn...')
#6 C:\Users\pause\Local Sites\cs-tests\app\public\wp-includes\rest-api\endpoints\class-wp-rest-autosaves-controller.php(451): WP_REST_Revisions_Controller->prepare_item_for_response(Object(WP_Post), Object(WP_REST_Request))
#7 C:\Users\pause\Local Sites\cs-tests\app\public\wp-includes\rest-api\endpoints\class-wp-rest-autosaves-controller.php(253): WP_REST_Autosaves_Controller->prepare_item_for_response(Object(WP_Post), Object(WP_REST_Request))
#8 C:\Users\pause\Local Sites\cs-tests\app\public\wp-includes\rest-api\class-wp-rest-server.php(1292): WP_REST_Autosaves_Controller->create_item(Object(WP_REST_Request))
#9 C:\Users\pause\Local Sites\cs-tests\app\public\wp-includes\rest-api\class-wp-rest-server.php(1125): WP_REST_Server->respond_to_request(Object(WP_REST_Request), '/wp/v2/pages/(?...', Array, NULL)
#10 C:\Users\pause\Local Sites\cs-tests\app\public\wp-includes\rest-api\class-wp-rest-server.php(439): WP_REST_Server->dispatch(Object(WP_REST_Request))
#11 C:\Users\pause\Local Sites\cs-tests\app\public\wp-includes\rest-api.php(449): WP_REST_Server->serve_request('/wp/v2/pages/2/...')
#12 C:\Users\pause\Local Sites\cs-tests\app\public\wp-includes\class-wp-hook.php(324): rest_api_loaded(Object(WP))
#13 C:\Users\pause\Local Sites\cs-tests\app\public\wp-includes\class-wp-hook.php(348): WP_Hook->apply_filters('', Array)
#14 C:\Users\pause\Local Sites\cs-tests\app\public\wp-includes\plugin.php(565): WP_Hook->do_action(Array)
#15 C:\Users\pause\Local Sites\cs-tests\app\public\wp-includes\class-wp.php(418): do_action_ref_array('parse_request', Array)
#16 C:\Users\pause\Local Sites\cs-tests\app\public\wp-includes\class-wp.php(813): WP->parse_request('')
#17 C:\Users\pause\Local Sites\cs-tests\app\public\wp-includes\functions.php(1336): WP->main('')
#18 C:\Users\pause\Local Sites\cs-tests\app\public\wp-blog-header.php(16): wp()
#19 C:\Users\pause\Local Sites\cs-tests\app\public\index.php(17): require('C:\\Users\\pause\\...')
#20 {main}
  thrown in C:\Users\pause\Local Sites\cs-tests\app\public\wp-content\plugins\code-snippets-pro\php\front-end\class-block-editor.php on line 198
@pauserratgutierrez pauserratgutierrez changed the title Content Snippet Gutenberg Block Error "Content Snippet" & "Snippet Source Code" Gutenberg Blocks Error Dec 10, 2024
@sheabunge
Copy link
Member

@sheabunge sheabunge self-assigned this Dec 11, 2024
@sheabunge sheabunge removed their assignment Dec 20, 2024
@imantsk
Copy link
Member

imantsk commented Jan 1, 2025

I wasn't able to verify the fix since i couldn't find the code snippets blocks in the block selection menu in Gutenberg
additionally i noticed this error in console:

site-editor.php:1 Refused to apply style from 
'https://cautious-space-broccoli-q9x75w4pr529p75-80.app.github.dev/wp-content/themes//workspaces/code-snippets-ddev/code-snippets-pro/src/vendor/freemius/wordpress-sdk/assets/css/admin/common.css?ver=6.7.1' 
because its MIME type ('text/html') is not a supported stylesheet MIME type, and strict MIME checking is enabled.

not sure if its related

@imantsk imantsk reopened this Jan 1, 2025
@imantsk imantsk assigned imantsk and sheabunge and unassigned imantsk Jan 1, 2025
@imantsk imantsk removed the bug label Jan 1, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants