Why URL of my Wordpress website is not working?

Hi there,
Just started my first Frontity project, it seems a very good platform for using WordPress as headless CMS, but I’m dealing with a strange problem, when I put my URL in frontity.settings it’s not fetching any data at all from my website, in case that I use the default URL “test.frontity.org” it’s fetching all the data. Do I need to install any plugins to structure my URL or it is the problem with anything else.

Hi! Are you using WordPress.com or WordPress.org? We had this problem before with a WordPress.org installation that have the Rest API blocked by some security plugin. The first thing I would do is check if is possible to access directly through the browser to the WordPress API by putting “wp-json” behind your domain.

Something like this:
https://example.com/wp-json/
Or
https://example.com/wp-json/wp/v2/posts

If it returns a json, the problem may be on the frontity.settings itself. I hope it helped you.

3 Likes

Thanks Hussein for the reply, I have tried also some other Url from different projects that are using Frontity, and they all worked, also my WordPress website doesn’t have any plugins that block Rest API cause when I’m putting /wp-json I can access all the data. Do you have any idea why it’s not working? Does my WordPress have problems on its own? Or should I do something with my WordPress that I haven’t done or configure my frontity.settngs.js?

Thats weird. Can you put here the frontity.settings.js so we can take a look?

Hi @rinnori.m

Welcome to the Frontity community. We’re excited to see what you build with Frontity.

I’m sorry that you’re experiencing a problem at this early stage of your Frontity experience. As @Hussein has suggested see if you can view the JSON data in your browser. You can use the examples he provides.

We have also just published this guide which may help you to configure your REST endpoint URL correctly.

Again as suggested by @Hussein it would be useful to see the contents of your frontity.settings.js file if you’re still experiencing problems after you’ve followed the guide I’ve linked above.

2 Likes
const settings = {

  "name": "360kompakt",

  "state": {

    "frontity": {

      "url": "https://360kompakt.de",

      "title": "Test Frontity Blog",

      "description": "WordPress installation for Frontity development"

    }

  },

  "packages": [

    {

    "name": "360kompakt",

    },

    {

      "name": "@frontity/wp-source",

      "state": {

        "source": {

          "url": "https://360kompakt.de/wp-json"

        }

      }

    },

    "@frontity/tiny-router",

    "@frontity/html2react"

  ]

};

export default settings;

Also when I put that URL the console log me “GET http://localhost:3000/ 404 (Not Found) this”. Thanks in advance for the effort you take to help me.

Hi @rinnori.m

You need to remove the wp-json part from state.source.url. It should look like this:

"state": {
   "source": {
     "url": "https://360kompakt.de"
  }
}
1 Like

Broken code is probably the most common reason why WordPress sites won’t load. Unfinished or incomplete auto-updates for your WP site or WPplugins. Incompatible plugins, poor plugin or theme coding. I hope it will help you to remove your site issue.