I think I managed to fix it
add_action('rest_api_init', function(){
register_rest_route('endpoint', '/sportivity', [
'method' => 'POST',
'callback' => 'sportivity_endpoint',
]);
});
function sportivity_endpoint($request){
$json = $request->get_json_params();
$json['test'] = 'Jan';
return $json;
}
When I go to url/wp-json/endpoint/sportivity it returns the json now.
Related Posts:
- How to create custom 401, 403 and 500 error pages?
- Why have on every line
- add_action in namespace not working
- Variables declared in header not available in other includes
- Hide old attachments from wp media library
- Failed to open stream / no such file or directory
- Customizer Show/Hide Logo and Site Title
- Need to get specific data from array
- Use different javascript files for each page on website
- body_class filter – Is there a better way to write this code?
- WooCommerce – Fixed quantity of a product [closed]
- How to create post thumbnail
- Settings API – sanitize_callback is not called and it leads to an incorrect behavior
- Query String being Removed Creating a Pagination Issue within a Custom Plugin
- Function set default image when image not present
- How to get the POST TITLE using the POST ID?
- Importing hard coded custom field into acf field
- Adding country tags automatically
- js file in root loading without
- From where the header-text can be changed in WordPress custom header?
- Trying to establish connection to External Database
- Load a page into a div with Ajax
- How to create a form and display its content as table in admin panel?
- Login/logout in header
- Trying to get property of non-object “ wordpress ”
- $wpdb->update with multiple parameters gives error
- loop through meta_query relations [closed]
- Improve page speed loading using CDN and async or defer attribute
- Applying A Category to Existing Posts Where Page Title Matches Regex
- Dashboard broken into list of links
- Displaying recent posts on static page with template-part via shortcode
- Get the date of the className or classID
- Fancybox type popup window that’s not an iframe
- My custom get_the_excerpt() can’t get excerpt by ID
- how to make my website secured
- deactivating an active plugin using if page
- Single Quotes in .php file doesn’t load website
- element not working in Safari [closed]
- What file have I to create in my custom WordPress theme to show all the post belonging to a specific category?
- Exclude specific post from displaying
- {$key} or $key?
- Display the 3 latest WordPress Posts on a Static Page Outside WordPress
- Check class_exists before class definition / Doxygen problem
- How do I create a secondary version of the_content
- Extract links from content
- url_to_postid returns 0
- How do i add slugs to a URL, but still redirecting to the same page
- Noindex subscriber author page
- How to Fix an Archive.php That Displays All Posts?
- Dynamically replicate custom metabox in custom post type
- implementing a jQuery “click to expand” link in WordPress [closed]
- How to tell if a user has gone in and created a menu
- Fatal error: Cannot redeclare comment_theme()
- Change Query Arguments (filter) with jQuery/Ajax or PHP?
- WordPress Fresh Install Errors (Woocommerce specifically now)
- Tracking Visitor LatLng with WordPress using JS, PHP. How to put data which was extract using JS into DB
- php script in elementor
- WP-Bakery – Add custom colors to buttons with template colors
- how do i add custom widget woocommerce shop page with php
- WordPress redirect to a subpage – how to create a template for subpage?
- How to show 1 random post result without using an array?
- How can I redefine WordPress wp-content directory programmatically?
- Trim Titles Only On Some Pages
- Commenting requires wordpress login, wordpress discussion and post comments tick boxes are checked
- My top header looks different on single pages but is fine on the home page
- Automatic email message after manual user approval
- can I extend the WP_Query class to deal with ‘duplicate’ posts created by joining to wp_posts?
- Enqueue sripts and styles only if function is called
- Add widget area from visual editor
- Return author name as a tag using get_author
- How to pull date/time in french format for wordpress post?
- WooCommerce subcategories help
- What is wrong with this shortcode? to include external php file in WordPress posts
- Echo Option Value Based On WordPress User Role
- WordPress Redirect / Add_Rewrite_Rule – Non Index.php Page
- Adding custom PHP to existing loop in Genesis
- Migrating a live WordPress website to a Local Server: why some elements of the website are missing?
- Store stripe info as user_meta
- Is there a way to have chunks of a page’s content expire?
- index.php navigation
- Loop returns more items than exist?
- Formatting Shortcode to Display in Visual Mode
- wp_nav_menu doesn’t work in a duplicate server
- Rewriting to a different page based on existence of query string?
- WordPress upload images not displaying
- How to get category pages to look like a certain archive page?
- Host does not allow remote connection, so how do I transfer data to my WordPress site?
- MySQL Engine vs. Charset
- I am extending Walker_Nav_Menu: How can I get the number of children elements of the current item?
- How to call a specific value within the functions.php file?
- How to define template directory in this widget code
- WordPress plugin/code to to to next/previous post in same category
- How to use js variable to php in wordpress functions.php
- Display total count of products in orders of a specific order status
- REST API custom endpoints for metaboxes
- Add default block css when the block has been added with php?
- How to initialise WP_Query on the basis of a specific meta_value and continue iterating rest?
- Custom Post Type doesn’t have template content when creating programmatically in PHP but does when created in WP Admin
- how can i link threejs in my functions.php file in understrap theme
- WordPress / PHP: Check if column has value and then check if value in array