• Resolved richacinas

    (@richacinas)


    Hi there,

    I’ve searched everywhere and can’t find a solution.

    I’ve already disabled all plugins except contact-form-7, cleared cache all the time, tried again, refreshed nonce key in wp-config.php.

    I have tried as well to allow cors from every website:
    add_header 'Access-Control-Allow-Origin' '*';

    add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';

    However, everytime I access a url of my website containing a form, I get this error on console:

    {
    "code": "wpcf7_forbidden",
    "message": "No tienes permiso para acceder al formulario de contacto que solicitas.",
    "data": {
    "status": 403
    }
    }

    Any idea why? This is recent and I have no idea about what have changed.


    Thank you very much,

    Ricardo

    The page I need help with: [log in to see the link]

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter richacinas

    (@richacinas)

    I realized the piece of code raising the error is this one:

    File:
    …/plugins/contact-form-7/includes/rest-api.php

    register_rest_route(

          self::route_namespace,

          '/contact-forms/(?P<id>\d+)',

          array(

            array(

              'methods' => WP_REST_Server::READABLE,

              'callback' => array($this, 'get_contact_form'),

              'permission_callback' => static function (WP_REST_Request $request) {

                $id = (int) $request->get_param('id');

                if (current_user_can('wpcf7_edit_contact_form', $id)) {

                  return true;

                } else {

                  return new WP_Error(

                    'wpcf7_forbidden',

                    __('You are not allowed to access the requested contact form.', 'contact-form-7'),

                    array('status' => 403)

                  );

                }

              },

            ),

    ...
    ...
    ...
    Plugin Author Takayuki Miyoshi

    (@takayukister)

    What other plugins and theme do you use on the site?

    Thread Starter richacinas

    (@richacinas)

    I realized the cause of the problem was a redirection that was set in my Nginx config.

    Sorry about that.

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘All forms not working – wpcf7_forbidden’ is closed to new replies.