Rest API authentication issue when called from fetch request in bundle.js

The problem is that you’re not using the correct name for the REST API nonce header — the correct name is X-WP-Nonce, but you used X-WP-Header: fetch(‘http://localhost/wptest2/?rest_route=/wp/v2/users/me’, { method : ‘get’, mode : ‘cors’, headers : { ‘Access-Control-Allow-Origin’ : ‘*’, ‘X-WP-Header’ : _wpnonce // here you used the wrong name } }) Reference from the … Read more

$_SESSION variables lost during OAuth callback

With my version of wordpress there is NO session. So when I call $_SESSION[‘callback_state’]=stuff it’ll gladly save it to a temporary stack local variable instead of with the actual session. So before you redirect do: if (!session_id()) {session_start();} //then the normal redirect header(“location: $newUrl”); exit(0);

Hide/Show content based on cookie

An idea is to use some CSS if you want to apply this logic to many elements on different pages. You can add this code to header.php for example : if(!isset($_COOKIE[“user_type”])) { <style>.hide_content {display:none!important}</style> } Then you can simply add the CSS class to all elements you want to hide when cookies are set.

Creating intro page in wordpress

1) Use meta tag fro redirection <meta http-equiv=”Refresh” content=”6; URL=yoururlhere” /> Where the current page will redirect to the given url after 6 seconds. 2) For showing the intro page only for new visitors that is if somebody already seen that it must not be displayed again. for that check in your page header.php add … Read more

Is there any reason only 1 (my) IP would be added to this table using $wpdn->insert?

Are you using the same internet connection on multiple devices? Perhaps your mobile is connected to the same wifi network. Visit http://icanhazip.com in your mobile to see its IP. As for browserstack perhaps they aren’t accepting the cookie so their IP doesn’t get recorded. You should record the timestamp as well so you can correlate … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)