The callback has to be public:
public function respondWithString()
And in your register_rest_route()
call, set the callback
to [ $this, 'respondWithString' ]
:
register_rest_route( $this->urlBase, 'dummy', [
'methods' => 'GET',
'callback' => [ $this, 'respondWithString' ],
] );
Related Posts:
- What is PHPSESSID?
- start_lvl Ignored in Custom walker_nav_menu
- PHP Catchable fatal error: Object of class WP_Error could not be converted to string
- What would be a PHP command to erase all posts from category X from the last month?
- Load custom field value into div with AJAX
- Get the title before comma
- Accessing a random image via ajax
- wp enqueue style and style sheet depth
- Display 4 chronological posts starting with a random post
- Duplicates with WP_Query loop
- my function doesn’t return my post from today
- “Notice: Undefined variable: content” is showing [closed]
- How should I best target dynamically served content?
- using add_action for a header hook that has an additional parameter
- Template part inside shortcode, unexpected reult
- How to enqueue CSS and JS only on specific template?
- get_the_terms – only top level
- Have CSS Class Added with `is_page()` WP function
- Category Thumbnail Display – How to display ONLY the main Category
- how to retrieve uploaded url of zip files
- Using a `Template Parts` folder instead of an `Includes` folder in a Custom WordPress Theme
- RecursiveDirectoryIterator not working in admin
- Call global variable array() in woocommerce child/template
- PHP WordPress optimization my loop code
- custom fields wordpress
- WordPress Sending data to Ajax with select option
- Get value from shortcode to do something
- SQL Injection blocked by firewall
- PHP 8, AJAX mail form to function.php doesn’t work
- Changes in permalink structure in WordPress and how to apply to in-site links
- How to create global title in header of wordpress theme
- WP Cron job timeout issues
- Can’t find infinite loop cause
- how to make custom ajax handler?
- Trouble Installing WordPress Get PHP Not Running Answer
- Shortcode returns values in the wrong order
- Hardening uploads folder in IIS breaks images
- WordPress import media error
- Creating a mobile site by adding a new class to the body tag from functions.php
- Using WP functions such as the_title() in an included php file
- Show recent posts starting at a specific number archive
- Issue with fetching mysql data and displaying results via shortcode in webpage
- How to unserialize data from MySQL
- if ( ! function_exists
- Exclude product attributes from taxonomy terms loop
- WP All Import / Update stock quantity from multiple XML files
- Split site title and apply different classes
- Alter Woocommerce product archive structure
- Pass get data from anchor URL [closed]
- WordPress İmages Upload & Delete Error
- Shortcode won’t execute
- Dynamic CSS through PHP issue
- posts_nav_link pulling in multiple post types
- security concerns if using html data-* attribute for l10n?
- Ajax on the Administration Side of plugin – wp_localize_script – how to pass value from JQuery to PHP function in class?
- php_gd2 extension not loading on Windows
- How to check a variable Changes
- Products listing check if meta checkbox is checked
- Check if user had autologin & if so, logout
- White screen after migrating site, but wp-admin works fine. Disabling all plugins, applying default theme and enabling debug mode does nothing
- Executing php on button press
- How do I change the “login” label in My Account page to “Registered Customer”
- Edit a function to take different actions based on user role
- How to have different headers.php files based on the display page
- Customize the “Available for back order” text for specific variation
- If user has clicked link add class and store using PHP/WordPress
- How to put 2 php codes in functions.php without site crashing
- Site infected by link
- How to create an Email Subscription input in WordPress?
- autocomplete in wordpress using ajax with json-data
- Using previous_post_link next_post_link but with a filter on a custom field
- How to filter specific element of an array in wordpress/php?
- wp-login.php?redirect_to=https problem
- Right path for renaming a file in uploads folder
- View tag description on page
- Fatal Error cannot log into wordpress and website disappeared
- Private messaging – Getting and displaying the avatar/url of a message recipient
- Updating custom user meta
- changing static link to relative link
- Trying send mail from Theme page
- AJAX Not Working With WordPress Database properly
- Pagination for div’s
- Adding theme support for a custom header image
- Dynamic Post Type Variable echo as string?
- How can I put a custom field as the link of a button shortcode?
- WordPress: Create A Widget to Accompany Plugin
- Fix My Custom Function: Remove Automatic
- SHARING TO FACEBOOK – FROM DYNAMICALLY GENERATED PAGE
- Adding placeholder text field to woocommerce checkout [closed]
- Cannot modify header information – headers already sent
- WP Debug enabled Undefined index error in a widget
- Can I have a php site on subdirectory of WordPress?
- How would I split the results into two columns [closed]
- is there away to hide php code in wordpress not to show in PAGES
- Millennial Media PHP Setup ( Code Integration )
- Insert into db with foreach problem
- Custom taxonomy with page post type – WordPress
- Alternative to php echo within code
- Why does WordPress not send the user the email to add a password?
- How to put a class in the p tag automatically added by the_content() in the wordpress loop?