Skip to content

Instantly share code, notes, and snippets.

@anwppro
Last active May 11, 2025 13:04
Show Gist options
  • Select an option

  • Save anwppro/98df192271a27e897145033ff58cd284 to your computer and use it in GitHub Desktop.

Select an option

Save anwppro/98df192271a27e897145033ff58cd284 to your computer and use it in GitHub Desktop.
add_action( 'rest_api_init', 'anwp_fl_templater_add_rest_routes' );
function anwp_fl_templater_add_rest_routes() {
register_rest_route(
'fl',
'/games/',
[
'methods' => 'GET',
'callback' => 'anwp_fl_templater_api_games',
'permission_callback' => function () {
return true;
},
]
);
}
function anwp_fl_templater_api_games() {
global $wpdb;
return rest_ensure_response( $wpdb->get_results( "SELECT * FROM {$wpdb->prefix}anwpfl_matches" ) );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment