Here are a few examples of how you can use the Ubersuggest API to interact with the tool from within a WordPress plugin or theme:
php
// Get keyword ideas for a given seed keyword
$keyword = 'best laptops';
$response = wp_remote_get( 'https://api.ubersuggest.org/v2/keyword-ideas?keyword=' . urlencode($keyword) . '&language=en&country=us&api_key=YOUR_API_KEY' );
$data = json_decode( wp_remote_retrieve_body( $response ), true );
print_r($data);
// Get search volume and other metrics for a keyword
$keyword = 'best laptops';
$response = wp_remote_get( 'https://api.ubersuggest.org/v2/keyword-overview?keyword=' . urlencode($keyword) . '&language=en&country=us&api_key=YOUR_API_KEY' );
$data = json_decode( wp_remote_retrieve_body( $response ), true );
print_r($data);
// Analyze a website's SEO
$domain = 'neilpatel.com';
$response = wp_remote_get( 'https://api.ubersuggest.org/v2/site-audit?domain=' . urlencode($domain) . '&language=en&country=us&api_key=YOUR_API_KEY' );
$data = json_decode( wp_remote_retrieve_body( $response ), true );
print_r($data);
To use these examples, you'll need to replace `'YOUR_API_KEY'` with your actual Ubersuggest API key. You can get an API key by signing up for a Ubersuggest account and generating one in the dashboard.
The first example retrieves keyword ideas for the seed keyword "best laptops". The second example gets search volume and other metrics for the same keyword. The third example analyzes the SEO of the website "neilpatel.com".
You can then use the data returned from these API calls to display information, generate reports, or make decisions within your WordPress plugin or theme. Keep in mind that the Ubersuggest API has usage limits, so be mindful of how frequently you make requests.
Citations:[1] https://www.elegantthemes.com/blog/wordpress/ubersuggest-seo-research
[2] https://www.contentpowered.com/blog/ahrefs-ubersuggest-keyword-research/
[3] https://neilpatel.com/blog/10-wordpress-plugins-to-turn-your-site-into-an-seo-powerhouse/
[4] https://neilpatel.com/blog/optimize-website-free/
[5] https://neilpatel.com/blog/25-plugins-to-consider-after-creating-your-first-wordpress-site/