New endpoint that adds text to end of the file
New endpoint that adds text to end of the file
New endpoint that adds text to end of the file
First of all, you registered the route “latest-post”, but the URL you used is “latest-posts”. Second: In your “get_latest_post” function, you use the variable $category, but it is set nowhere. Fix the function like this: function get_latest_post ( $params ){ if(isset($params[‘category’])){ $post = get_posts( array( ‘category’ => $params[‘category’], ‘posts_per_page’ => 1, ‘offset’ => 0 ) … Read more
Rewrite Endpoints not Indexing with google
You’ll need to use a combination of add_rewrite_tag and add_rewrite_rule function setup_seo_endpoint() { // Ensures the $query_vars[‘item’] is available add_rewrite_tag( ‘%item%’, ‘([^&]+)’ ); // Requires flushing endpoints whenever the // front page is switched to a different page $page_on_front = get_option( ‘page_on_front’ ); // Match the front page and pass item value as a query … Read more
You can create a custom endpoint using the add_feed function. I have used this in the past to create custom iCal feeds. // Initialize the feed function your_add_custom_feed() { // This adds a feed http://example.com/?feed=myfeed add_feed(‘myfeed’, ‘your_create_feed’); } add_action(‘init’,’your_add_custom_feed’); // Create a function to form the output function your_create_feed() { // Query variables are accessible … Read more
It’s worth noting that the answer above is out of date. The data store should now look like this: const actions = { setUserRoles( userRoles ) { return { type: ‘SET_USER_ROLES’, userRoles, }; }, receiveUserRoles( path ) { return { type: ‘RECEIVE_USER_ROLES’, path, }; }, }; const store = registerStore( ‘matt-watson/secure-block’, { reducer( state = … Read more