REST API retrieving posts from www.sitename.com/category/news/ instead of just just from www.sitename.com

If you want to retrieve posts, you need to use the posts endpoint for starters, not pages. So that’s wp-json/wp/v2/posts. The documentation for that endpoint is here.

As you can see in the documentation, under List Posts, you can retrieve posts for a specific category using the categories argument. However, you need to use the category ID, not the slug.

http://example.com/wp-json/wp/v2/posts/?categories=14

If you absolutely must use the slug, then you need to retrieve that first, from the categories endpoint:

http://example.com/wp-json/wp/v2/categories/?slug=news

That will retrieve any categories with news as the slug. This response will include the category ID which you can store and use to query posts with that category.

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)