I have added button to tinymce editor, which opens Popup using TinyMCE window manager and popup file is sbb-pop.php.

I want to show settings using get_option() on popup window. But it throws error get_option() is undefined.

Below is code in sbb-popup.php

$apikey =  get_option('sbb_api_key_value');
  $api_link = 'https://1securecart.net/Maint/CatalogItem/GetCatalogItems?APIKey='.$apikey; 

Here is JS to add button and show popup.

(function($) {
    tinymce.PluginManager.add('sbb_mce_btn', function( editor, url ) {
        editor.addButton( 'sbb_mce_btn', {
            text: 'SBB',
            icon: false,
            type: 'menubutton',




Is there another way to load options in popup window ? I can not include wp-load.php according to WordPress standard.

  • If your serialized array counter doesn't matched with the data inside the key value, it can behave like this. I had a similar issue. I'm not saying this is your issue, but trying make you concern about things like this. :) Jan 6, 2016 at 6:38
  • @MayeenulIslam Actually It works if I include wp-load.php from root directory. But Its not according to WP standard.
    – Suraj
    Jan 6, 2016 at 6:42
  • It looks like you are not in wordpress contest, thats the reason you are getting error get_option() is undefined.
    – WPTC-Troop
    Jan 6, 2016 at 7:02
  • How to be in wordpress context when you open open popup using TinyMCE widowmanager ?
    – Suraj
    Jan 6, 2016 at 10:06


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.