WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I can't to call the a filter hook on a php external file of wordpress.

This is my code - my_external_file.php -:

require( dirname(__FILE__) . '/../../../../../../../wp-load.php');

add_filter('init', 'test_function');

function test_function (){
    global $global_text_to_shown;

    $global_text_to_shown = 'Hello World';


global $global_text_to_shown;

$quicktags_settings = array( 'buttons' => 'strong,em,link,block,del,ins,img,ul,ol,li,code,spell,close' );

//This work fine, shown editor good.
wp_editor( $global_text_to_show, 'content', array( 'media_buttons' => false, 'tinymce' => true, 'quicktags' => $quicktags_settings ) );

//Load js and work fine the editor - wp_editor function.


The problem is that not load or execute the filter hook and 'test_function' function, can't take value: $global_text_to_shown = 'Hello World';

How i can execute hook on external PHP file?

share|improve this question
I am pretty sure that wp-load.php will run the init hook before your function gets attached. But please explain what you are doing and why. There may be a better way to do this. – s_ha_dum Aug 28 '13 at 21:50
@s_ha_dum: I need call a hook filter in this php file. The wp_editor, html specifics, not send submit data and i need add this hook add_filter('tiny_mce_before_init', 'update_rte'); this function work fine when i doing on post/page. Can help me now? You need more description about? – Jose Carlos Ramos Carmenates Aug 28 '13 at 22:29
That doesn't tell me what you are doing or why. What is the point? What is the end goal? I suspect you may have an XY problem. – s_ha_dum Aug 28 '13 at 22:35

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.