Rest API in self-hosted page doesn’t work [closed]

I’m pretty sure you’re not using self-hosted WP, since you clearly mentioned that your site is running on wordpress.com… And if it really is hosted on WordPress.com, then you’ll have to use REST API a little bit different. Your API is available here: https://public-api.wordpress.com/wp/v2/sites/srebelo80.wordpress.com Here you can find Console – you can use it for … Read more

REST Endpoint API 404

There are few problems: you are using \WP_REST_Server::CREATABLE which is executed only when the request type is POST, if you are just opening the URL in the browser use \WP_REST_Server::READABLE instead (or \WP_REST_Server::ALLMETHODS to accept any request type). your callback is ‘callback’ => [$this, ‘import_csv’], but it should be ‘callback’ => [$this, ‘import_csv_file’], as the … Read more

Getting taxonomies associated with a specified post type

Yes, you can pass a post type to getEntityRecords() and also getTaxonomies(), both using the same format which is an object of arguments: Using getEntityRecords(): wp.data.select( ‘core’ ).getEntityRecords( ‘root’, ‘taxonomy’, { type: ‘post’ } ) Using getTaxonomies(): ( which is actually a shorthand for the above code ) wp.data.select( ‘core’ ).getTaxonomies( { type: ‘post’ } … Read more

Pull in ALL posts from the last two weeks using Rest API

Use PHP’s strtotime() function to retrieve the timestamp for the date fourteen days ago, then date() to cast it into an ISO 8601-compliant string which can be passed into the after parameter. I’m using sprintf() here to insert the date just to keep things a bit cleaner and avoid a mess of concatenation. $url = … Read more