Ask your WordPress questions! Pay money and get answers fast! (more info)

WP Settings Framework (Fatal error: Call to undefined function) WordPress

  • SOLVED

Re: http://wpquestions.com/question/showChronoLoggedIn/id/10239

I am having an issue with using the WordPress Settings Framework. It works fine when used with a theme, however I get a "Fatal error: Call to undefined function" error when I try to access WordPress Settings Framework functions within another plugin.

Is there something I should be adding to the header of my plugins?

I would appreciate some assistance.


<strong>UPDATE</strong>

ERROR: Fatal error: Call to undefined function wpsf_get_setting() in /home/.../wp-content/plugins/pager/disable-content-filter.php on line 3

CODE:



$dfilter = wpsf_get_setting( 'my_example_settings', 'general', 'filter_status' );

if($dfilter == "on") {

global $my_class;
remove_filter( 'the_content', array($my_class, 'wp42342_content_filter', 20) );

}

Answers (2)

2014-12-20

zebra webdesigns answers:

Hello Booruguru.

replied to your message.


zebra webdesigns comments:

also if you could paste the error message fully it will be helpful.


zebra webdesigns comments:

Hello Mate

you need to use get_option instead of that function.
pager plugin loads prior to wpsf plugin thats why the function is not recognized.

you can use the below method.


$wpsf_settings = get_option("my_example_settings_settings");
//print_r($wpsf_settings)
//take out the above comment to see all the settings.
echo $wpsf_settings['my_example_settings_general_filter_status'];


so you code will be


$wpsf_settings = get_option("my_example_settings_settings");
$dfilter = $wpsf_settings['my_example_settings_general_filter_status'];

if($dfilter == "on") {
global $my_class;
remove_filter( 'the_content', array($my_class, 'wp42342_content_filter', 20) );
}


booruguru comments:

Thank you for your help Zebra...again.

2014-12-20

Arnav Joy answers:

How you are calling the function in other plugin ?