WordPress Facebook plugin: cannot save App ID and Secret

Note: This article is very old, about plugin that has moved to a newer version, and probably no longer has this issue.

How to solve WordPress Facebook plugin: cannot save App ID and Secret. If you ran into a problem that no matter what you try, no matter how many times and with different Browsers, when you hit save, your App ID and Secret fields return empty.


Facebook Logo

Facebook Logo

Latest WordPress 4.0 and official Facebook plugin for WordPress 1.55 (at the time of this writing), and on some hosting environments, for reasons unknown, this plugin does not work properly. Either because of some misconfigurations on the server side (PHP-MySQL related), or because of the plugin itself, sometimes you will not be able to properly configure it.

Facebook For WordPress Plugin

Facebook For WordPress Plugin
(click to enlarge)


Solution presented here is not so straightforward if you are not familiar with Apache-MySQL-PHP Stack (WAMP/MAMP/LAMP for short, where W=Windows, L=Linux, M=Mac OS) but it is relatively easy to perform.

1) First, you need to install XAMPP or WAMP development environment under Windows OS (XAMPP has equivalent versions for Linux and Mac OS). I prefer to use portable editions, but this is up to you.

2) Install WordPress, as you would under any other server

3) Install Facebook for WordPress plugin, as you already did on your online edition

4) Enter App ID and Secret in your local Facebook plugin’s settings page (under your Xampp/Wamp dev environment)

Now we come to the final stage: whole idea here is to copy and paste your Facebook for WordPress plugin setting from your local database installation into your online WordPress’s database:

5) Open phpMyAdmin and locate row that contains facebook_application column inside wp_options wordpress database table, and copy entire a:0:{} code into clipboard.

Your code will start with an a: followed by some number: and separate code inside curly brackets {} depending on you APP ID and SECRET codes:

Facebook For WordPress Plugin wp_options Database Settings #3

Facebook For WordPress Plugin wp_options Database Settings (click to enlarge)


a:0:{s:6:”app_id”;s:16:”APP ID CODE HERE”;s:10:”app_secret”;s:32:”SECRET CODE HERE”;s:13:”app_namespace”;s:9:”tehnoblog”;s:12:”access_token”;s:44:”SECRET TOKEN CODE HERE”;s:15:”appsecret_proof”;s:64:”APP SECRET PROOF CODE HERE”;}


For those who are familiar with PHP, the above string stored inside WordPress Database is known as serialized data. In serialized string preceding letters have a special meanings: “a” represents array, letter “s” represents string, capital letter “O” represents Object, capital letter “C” represents Class, letter “i” represents integer (whole number), letter “d” represents decimal number (float), letter “b” represents boolean value (e.g. true or false). The only variable that cannot be serialized/unserialized in PHP is resource type, which simply returns i:0 (integer with zero value) after serialization procedure.

s:number | this indicates the length of your string; for instance:

s:6:”app_id” | app_id word has 6 characters in length
s:13:”app_namespace” | app_namespace word has 13 characters
s:9:”tehnoblog” | tehnoblog word has 9 characters in length
s:12:”access_token” | access_token word has 9 characters in length
s:15:”appsecret_proof” | appsecret_proof word has 15 characters in length

APP ID is in my case 16-characters in length

SECRET CODE is standard and 32 characters in length

SECRET TOKEN is probably variable in length (I do not know how it is calculated, and it is for additional layer of security)

APP SECRET PROOF same story as for the TOKEN above

As we can see, the first look on the above sequence looks complex, but it is in fact very simple once we split it in smaller sections and get to understand what the numbers mean.

6) Go back to your online hosting server, connect to MySQL WordPress database with phpMyAdmin (check your cPanel or Management Console, you should see something like phpMyAdmin icon shortcut), and locate the very same line of facebook_application inside wp_options table. It should be empty like this:

Facebook For WordPress Plugin wp_options Database Settings #1

Facebook For WordPress Plugin wp_options Database Settings
(click to enlarge)

7) Again, click on Edit link and paste the exact code from your local development environment version and click GO (equivalent of SAVE):

Facebook For WordPress Plugin wp_options Database Settings #2

Facebook For WordPress Plugin wp_options Database Settings
(click to enlarge)



Post A Comment

I have read and consent to Privacy Policy and Terms and Conditions