Unable to fix malformed JSON in wordpress - json

I am using woocommerce for the first time with wordpress in order to setup an e-commerce site. Everything is installed properly from wordpress to woocommerce plugin and the theme. But the problem resides.
Kindly check below image
I keep getting the same error again and again, I reinstalled the entire wordpress site but no luck. I followed few tutorials wherein they instruct to open browser console and check for a red line which I don't receive in my console.
What I get is in the image below
Also, somehow I am not even able to select another payment option other then cash on delivery which I have installed on my site. I have been struggling for last 3 days, but no luck! Kindly do not down vote this question. As I am feeling helpless at the moment.
The site is fashionburst.in
Thanks in advance

For anyone who might run into this issue, try to turn on debugging in wp-config.php
define( 'WP_DEBUG', true );
define( 'WP_DEBUG_LOG', true );
And then read the log file in wp-content/debug.log. I had a PHP error in one of my plugin's hooks and since the checkout is processed with JS, the checkout.min.js threw this error. Log file should give you proper error report (in my case I was using undefined PHP function).

Related

How to fix html error code in VsCode that says Enotdir: not a directory, stat?

I am very new to web development and I am starting my first project using frontendmentor.io. I began my project Monday and everything was working fine. All of a sudden on Tuesday, I began to get a error message when trying to open live server.
The error message reads:
Error: ENOTDIR: not a directory, stat '/Users/username/html/index.html/'
I have searched plenty of forums and cannot really find anything that fits my situation. I am using only HTML and CSS for this project. I uninstalled VSCode and I lost all of my previous work, so I only have the code that frontendmentor provided to get started, but I can post that below if needed. I am sure I did something wrong, I just cannot figure out what exactly.
I had that problem too.
I opened the CSS file with live server instead of index.html file and it works.

Wordrpress wp-json not found on server -- localhost

Here's the sitch:
I downloaded and installed Wampserver64 and Wordpress 5.2.3
I finally made it to my site, but I can't preview or publish pages with the new Gutenberg or block editor because something is broken! When I edit with the Classic Editor, it's all good.
****Here's not the notice I get from the Site Health Plugin****
The REST API is one way WordPress, and other applications, communicate with the server. One example is the block editor screen, which relies on this to display, and save, your posts and pages.
The REST API call gave the following unexpected result: (404)
Not Found
The requested URL /wordpress/wp-json/wp/v2/types/post was not found on this server.
Apache/2.4.39 (Win64) PHP/7.3.5 Server at sitefolder Port 80
I have scoured the internet on how to fix this but so far nada. Help much appreciated!
You have to add index.php after your folder name in the URL in order to make WordPress API work on the localhost.
For example: localhost/trial-wordpress/index.php/wp-json/wp/v2/posts
It worked for me.
If you're still working on it try the suggestions from this post: Wordpress REST API (wp-api) 404 Error Even if it's quite old there are some ideas you could try, like switching your permalink structure to sth. other than plain, check mod_rewrite under apache and so on. Classic Editor is not using the REST API, therefore no error.

Wordpress JSON API returns normal site page in html. How do I get it to give me JSON like it's supposed to

For example, entering http://mywordpresswebsite.example.com/?json=1 into the browser loads the main site html, the same as omitting the json querystring variable: http://mywordpresswebsite.example.com/
The JSON API is activated. I have tried reactivating and deactivating, checking .htaccess file settings, and deactivating all other plugins. None of those have made much difference so far.
TIA
I had the same problem with my localhost test page and was wondering, why my route worked last week and was not accessible this week.
Short explanation
After some tests and a lot of frustration, I was able to use the REST API Route again by following the wordpress documentation about routes-vs-endpoints with “Pretty Permalinks” and “Ugly” Permalinks
Longer explanation
I guess in my case it was based on the reinstall of my MySQL Database. By installing the new database, my previous setup has been reset to the wordpress standard installation with permalinks as "plain", which is an "ugly" permalink. That's the reason, why the answer of Mattygabe work for me after the reinstall of the database.
But with this solution, I had a problem with my filter value and therefore I found the solution with "pretty premalinks" and changed my permalinks to "Month and name", as shown in the picture. After this change, I could access my REST API via the desired route.
There could be also some difficulties with REST APIs related to the following examples:
using "wp" within the REST route
if you work on plugins, which should be shared, keep on mind that some plugins may restrict REST Access, e.g. iThemes Security
I'm likely doing it wrong, but when I form my requests for a Wordpress installation at http://www.example.com/ like this:
http://www.example.com/index.php?rest_route=/my/rest/route/here
I end up getting proper responses back.
I had a heck of a time figuring this out and ended up grokking a URL formatted like that in the HTML returned to me. I was expecting to make requests as http://www.example.com/wp_json/wp/v2/my/rest/route/here , but I only got HTML responses.
(FWIW, I am reposting this on all similar questions on the StackExchange network. Admins/mods - if this is against the rules or seen as rep spamming, feel free to take it down. Was hoping to help anyone else hitting the same issue I am, and to also learn what it is I've done wrong and why.)
Ok, so the new endpoint for Wordpress 4.7 is mywordpresswebsite.example.com/index.php/wp-json. It's part of Wordpress Core as of 4.7 and not a plugin anymore, there's nothing to be activated. Thank you, Mark Kaplun.
I also experienced this issue. I did install the WP API plugin and then realized I didn't need it so I deactivated it and deleted it. Afterwards I tried a GET request to https://example.com/wp-json/wp/v2/posts and received the HTML of my wordpress site.
To fix this I ended up deactivating all plugins and then I started receiving the JSON response from https://example.com/wp-json/wp/v2/posts so I stepped through each plugin reactivating and in the end all my plugins are active and the endpoint is responding with JSON.
I changed Permalinks (Settings => Permalinks)
I had an issue returning html page instead of JSON response on Wordpress 5.3 and I got resolved when I changed the Permalink as Post name from plain

Node.js express-admin "connect ECONNREFUSED"

I'm trying to get a nice admin GUI for databasing for node.js like you get from phpmyadmin.
That's where I found express-admin.
http://simov.github.io/express-admin-site/
I follow their instructions and installed it with no problem. When I ran the app.js I entered in my credentials, "database type", "database name", etc. I choose the default port 3000 and after I was finished I received "connect ECONNREFUSED", nothing more. I tried different ports and even copy pasted the .json file they provided in the tutorial. nothing seemed to work.
I have no problem hosting my application I have been working on so I don't believe it's the port.. [and no I was not hosting my application as the same time]
Thank you guys I hope to get some feedback! (:
Max, I'm the author of express-admin.
I just stumbled upon your question here. Even though a month have passed if you are still experiencing problems configuring the admin you can open up an issue here: https://github.com/simov/express-admin/issues (I get notified via email when someone opens up an issue there).
Also you should provide a more detailed information about your server/database set up + the full error message.

Wordpress import worked but can't access posts or pages

I've recently setup on my new VPS and successfully installed and imported my sql databse. However, after trying to click on any posts/pages, i get an error that the page can't be found.
Not Found
Logged in as admin, I can see all the posts and pages, yet clicking view just gives me the same message. The fact they are here means it must of imported them, just can't work out why I can't access them :S
Help!
If you can edit the posts in the admin, then you probably have the data and this is a url rewriting issue.
Try re-saving your permalinks, even without making a change.
If you can see the list of posts, but can't edit them then you probably have a bad import.