• Hello to all, I tried to add the code below to the functions.php file via Code Snippets, add_cap( ‘read_private_pages’ ); ?>

    but I get the following error message when I save it on the plugin:

    Could not create snippet. Request failed with status code 500

    The strange thing is that I tried it on another site and it worked perfectly well.

    Could you please help me find out what happened?

    Thank you very much!

Viewing 11 replies - 31 through 41 (of 41 total)
  • I’m seeing the same problem.
    Even without code. I see a number of problems, but it’s easier to give you the log:

    [03-Dec-2023 01:12:21 UTC] WordPress database error Invalid default value for 'modified' for query CREATE TABLE zdcu_snippets (
    				id          BIGINT(20)   NOT NULL AUTO_INCREMENT,
    				name        TINYTEXT     NOT NULL,
    				description TEXT         NOT NULL,
    				code        LONGTEXT     NOT NULL,
    				tags        LONGTEXT     NOT NULL,
    				scope       VARCHAR(15)  NOT NULL DEFAULT 'global',
    				priority    SMALLINT     NOT NULL DEFAULT 10,
    				active      TINYINT(1)   NOT NULL DEFAULT 0,
    				modified    DATETIME     NOT NULL DEFAULT CURRENT_TIMESTAMP,
    				revision    BIGINT(20)   NOT NULL DEFAULT 1,
    				cloud_id    VARCHAR(255) NULL,
    				PRIMARY KEY  (id),
    				KEY scope (scope),
    				KEY active (active)
    			) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci made by do_action('load-snippets_page_add-snippet'), WP_Hook->do_action, WP_Hook->apply_filters, Code_Snippets\Edit_Menu->load, Code_Snippets\Admin_Menu->load, Code_Snippets\DB::create_missing_table, Code_Snippets\DB::create_table, dbDelta
    [03-Dec-2023 01:12:21 UTC] WordPress database error Table 'SITE.zdcu_snippets' doesn't exist for query SELECT tags FROM zdcu_snippets made by require_once('wp-admin/admin-header.php'), do_action('admin_enqueue_scripts'), WP_Hook->do_action, WP_Hook->apply_filters, Code_Snippets\Edit_Menu->enqueue_assets, Code_Snippets\get_all_snippet_tags
    [03-Dec-2023 01:12:32 UTC] WordPress database error Table 'SITE.zdcu_snippets' doesn't exist for query SHOW FULL COLUMNS FROM zdcu_snippets made by require('wp-blog-header.php'), wp, WP->main, WP->parse_request, do_action_ref_array('parse_request'), WP_Hook->do_action, WP_Hook->apply_filters, rest_api_loaded, WP_REST_Server->serve_request, WP_REST_Server->dispatch, WP_REST_Server->respond_to_request, Code_Snippets\REST_API\Snippets_REST_Controller->create_item, Code_Snippets\save_snippet

    wordpress 6.4.1
    Code Snippets 3.6.2
    I use OpenServer:
    Apache
    php 7.4
    MySQL 5.5

    • This reply was modified 11 months, 3 weeks ago by polarone.

    I have the same problem but with a 404 on a brand new instawp site:

    Could not update snippet. Request failed with status code 404

    letaajohnson

    (@letaajohnson)

    I have this same issue. Was this snippet issue ever resolved? If so, what was the solution?

    studiografiki

    (@studiografiki)

    Same problem here:

    Could not update snippet. Request failed with status code 404

    Fresh install of wordpress 6.4.2 ??

    studiografiki

    (@studiografiki)

    For anyone having same problem:

    Try to re-save Permalinks in wordpress settings. Just go to permalinks and click “SAVE”.

    kingalani

    (@kingalani)

    Hello my friends, the problem is there is an add-on that stops the codes from working. It is better to stop all add-ons and work on Snippet.

    Hi –

    I am running into this issue as well, and noticed that the plugin is trying to make requests to my Site Address (x.com), as opposed to my WordPress Address (wp.x.com). My Site Address is where the site is actually located, but that is different from where WordPress is located for my instance.

    As such, the POST request to save a snippet isn’t hitting a WordPress URL, and in my case my website throws a CORS error, since the plugin is trying to hit a different domain.

    Access to fetch at 'https://x.com/blog/wp-json/wp/v2/users/me?context=edit&_locale=user' from origin 'https://wp.x.com' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: Redirect is not allowed for a preflight request.

    theschtickler

    (@theschtickler)

    Can confirm that @studiografiki’s fix worked for me

    Try to re-save Permalinks in wordpress settings. Just go to permalinks and click “SAVE”.

    Thanks @studiografiki

    @studiografiki @theschtickler in the multisite WordPress Superadmin dashboard there is no Permalinks in WordPress settings

    404 means there’s somthing missing and error 500 means your script processes too long = bad. can be server problem but most likely it’s your script, try splitting it into batches for example if you update few k products at once. turn on debug log and check the wp-content/debug.log file. dont forget to disable loggining otherwise file wll grow big and sooner or later you’ll be looking why there’s no space left

    @mcdeth

    Dear, what you say does not give any certainty since in my case this happened after an update and I have had the same problem for almost a year now, even reinstalling. Error Could not create snippet. Request failed with status code 500 appears but according to the debig there are no associated errors, so it definitely seems that the plugin must be migrated.

    ícono de validado por la comunidad
Viewing 11 replies - 31 through 41 (of 41 total)
  • The topic ‘Could not create snippet. Request failed with status code 500’ is closed to new replies.