text area getting error in admin page when using custom preview
-
Hi i am getting a “Error loading block: the response is a not valid JSON response”
in the editor when generating a preview of the block
to be far i am using a the textarea and putting html code in it.I am not even using those fields in the preview state. all i realy need
for the preview is the image is there any way to bypass this error
-
Hi @alienfactory,
Thanks for letting me know about that.Could you please paste here the exact text (or HTML like you mentioned) in the Textarea field, and the PHP template?
Thanks!
In my testing, the Textarea field didn’t show an error for markup like
<script></script>
- This reply was modified 4 years, 8 months ago by Ryan Kienstra.
also this is on php version 5.6.27
here is what i am adding to the text area
<div>Rebrand</div><div>Website</div><div>Product</div><div>Packaging</div><div>Advertisement</div><div>Leagacy</div><div>Eye-Fi brand</div>and here is the template
<?php $image_1_attachment = wp_get_attachment_image_src( block_value( 'image' ), 'full' ); $image = $image_1_attachment[0]; $url = block_value( 'url' ); $title = block_value( 'title' ); $category_one = block_value( 'category-one' ); $category_two = block_value( 'category-two' ); ?> <div class="slidingdoor"> <a href="<?php echo $url; ?>"><img class="img-responsive" src="<?php echo $image; ?>" alt="test" /> <div class="projectdetails" style="bottom: -82%;"> <div class="port-name"><?php echo $title; ?><img class="uparrow" src="/wp-content/themes/thisisitdesign/img/uparrow.png" alt="uparrow" /></div> <div class="col1"> <?php echo $category_one; ?> </div> <div class="col2"> <?php echo $category_two; ?> </div> </div> </a> </div> <div class="portspacer"> </div>
Nice, thanks! I’ll test that.
Are
category-one
andcategory-two
the Textarea fields?yes sir
Hm, does it help to change:
$image = $image_1_attachment[0];
to:
$image = isset( $image_1_attachment[0] ) ? $image_1_attachment[0] : '';
Though even with the template you shared, the block worked fine in my local:
Block fields: https://cldup.com/zvhGRRwXBu.png
Preview: https://cldup.com/6okgS1I8yD.pngIf by chance you haven’t already, could you try deactivating all other plugins?
so on my local machine it does work fine it’s when i move to my live site is the issue
and no your fix did not work now the image does not show anymore
and i did deactivate all plugins
OK, thanks for the details.
Could you please past the Site Health info from the live site here?
https://cldup.com/Ker8Z0xdHf.png
It’s a little intrusive to ask for all of this information, but I’m not sure how to help, as I can’t reproduce it.
here you go
## wp-core ### version: 5.3.2 site_language: en_US user_language: en_US timezone: +00:00 permalink: /%postname%/ https_status: false user_registration: 0 default_comment_status: open multisite: false user_count: 2 dotorg_communication: true ### wp-paths-sizes ### wordpress_path: wordpress_size: 657.61 MB (689551804 bytes) uploads_path: uploads_size: 111.52 MB (116941458 bytes) themes_path: themes_size: 49.01 MB (51391016 bytes) plugins_path: plugins_size: 25.13 MB (26349269 bytes) database_size: 1.88 MB (1974537 bytes) total_size: 845.15 MB (886208084 bytes) ### wp-active-theme ### name: version: 1.0 author: author_website: parent_theme: none theme_features: menus, widgets theme_path: ### wp-themes-inactive (6) ### Twenty Fourteen: version: 2.7, author: the WordPress team Twenty Nineteen: version: 1.4, author: the WordPress team Twenty Seventeen: version: 2.2, author: the WordPress team Twenty Sixteen: version: 2.0, author: the WordPress team Twenty Thirteen: version: 2.9, author: the WordPress team Twenty Twelve: version: 3.0, author: the WordPress team ### wp-mu-plugins (1) ### BPS MU Tools: version: 4.0, author: AITpro ### wp-plugins-active (3) ### BackWPup: version: 3.7.0, author: Inpsyde GmbH Block Lab: version: 1.5.3, author: Block Lab BulletProof Security: version: 3.9, author: AITpro Website Security ### wp-plugins-inactive (7) ### Akismet Anti-Spam: version: 4.1.3, author: Automattic BackWPup disable SSL connection verifying: version: 0.1, author: Inpsyde GmbH Classic Editor: version: 1.5, author: WordPress Contributors Easy Bootstrap Shortcode: version: 4.5.4, author: oscitas Hello Dolly: version: 1.7.2, author: Matt Mullenweg Stealth Login Page: version: 4.0.0, author: Jesse Petersen WP Admin Bar Removal: version: 2014.0816.0392, author: slangjis ### wp-media ### image_editor: WP_Image_Editor_Imagick imagick_module_version: 1620 imagemagick_version: ImageMagick 6.5.4-7 2012-05-07 Q16 OpenMP https://www.imagemagick.org imagick_limits: imagick::RESOURCETYPE_AREA: imagick::RESOURCETYPE_DISK: -1 imagick::RESOURCETYPE_FILE: 24575 imagick::RESOURCETYPE_MAP: 111 MB imagick::RESOURCETYPE_MEMORY: imagick::RESOURCETYPE_THREAD: not available gd_version: bundled (2.1.0 compatible) ghostscript_version: 8.70 ### wp-server ### server_architecture: Linux 2.6.32-896.16.1.lve1.4.51.el6.nfsfixes.x86_64 x86_64 httpd_software: Apache php_version: 5.6.27 php_sapi: cgi-fcgi max_input_variables: 1000 time_limit: 30 memory_limit: 256M max_input_time: 60 upload_max_size: 32M php_post_max_size: 33M curl_version: 7.48.0 OpenSSL/1.0.1e suhosin: false imagick_availability: true htaccess_extra_rules: true ### wp-database ### extension: mysqli server_version: 5.5.51-38.1-log client_version: 5.5.19 ### wp-constants ### WP_HOME: undefined WP_SITEURL: undefined WP_CONTENT_DIR: WP_PLUGIN_DIR: WP_MAX_MEMORY_LIMIT: 256M WP_DEBUG: false WP_DEBUG_DISPLAY: true WP_DEBUG_LOG: false SCRIPT_DEBUG: false WP_CACHE: false CONCATENATE_SCRIPTS: undefined COMPRESS_SCRIPTS: undefined COMPRESS_CSS: undefined WP_LOCAL_DEV: undefined DB_CHARSET: utf8 DB_COLLATE: undefined ### wp-filesystem ### wordpress: writable wp-content: writable uploads: writable plugins: writable themes: writable mu-plugins: writable
Thanks, that’s really similar to my local setup, where I didn’t see the issue. WordPress 5.3.2.
Thanks, it sounds like you’ve already tried disabling all plugins but Block Lab. Maybe ‘BulletProof Security’ or ‘BackWPup’ could interfere with the REST request, but that’s only a guess.
Does the issue still exist with the Twenty Twenty theme?
Also, do the core ‘Archives’ and ‘Latest Comments’ blocks have that same error? Those use
<ServerSideRender>
, like Block Lab.- This reply was modified 4 years, 8 months ago by Ryan Kienstra.
i had deactivated all plugins what your seeing in the system info was after i turn them back on since this is my production machine i did not want bps deactived
the core ‘Archives’ and ‘Latest Comments’ blocks work finei dont think it is a themem issue since this is only happening on the admin side
when in preview mode it works in all other situations.just adding this > or < causes the issue
OK, thanks. It sounds like this is an issue somewhere, but short of stepping through breakpoints on your server, I’m not sure if I can help with fixing it.
In my local, passing markup like
<script></script>
to a Textarea in my local works fine.The fetch() call that produces that error message doesn’t show the specific error:
https://github.com/WordPress/gutenberg/blob/03960e671cca1afee4f6ebbf20d0bdaf2170e672/packages/api-fetch/src/index.js#L87-L89- This reply was modified 4 years, 8 months ago by Ryan Kienstra.
- This reply was modified 4 years, 8 months ago by Ryan Kienstra.
I understand if you cant recreate the error it’s hard to trouble shoot
thanks for taking the time to look into thisSure, thanks for your patience.
I’ll keep this issue in mind, we might find a fix later.
- The topic ‘text area getting error in admin page when using custom preview’ is closed to new replies.