apply_filters to $GLOBALS

Assuming that $GLOBALS[‘Pootle_Page_Builder_Render_Layout’] carries an instance of Pootle_Page_Builder_Render_Layout, the method panels_render() returns a string. So you can simply pass the method call as an argument to apply_filters(): $content = apply_filters( ‘the_content’, $GLOBALS[‘Pootle_Page_Builder_Render_Layout’]->panels_render( $page_data->ID ) ); I’m not sure whether this is an intended use of the API of the plugin, as Pootle_Page_Builder_Render_Layout::panels_render() remove some default … Read more

global $post inside plugin query messes up every new post page in wp-admin

You have two problems in your code. You use $post as a iteration variable which is an habit best avoided You use setuppostdata which changes the global $post without you using any function that actually needs it your loop should look like foreach ( $pp_query as $p) : $pointer_query[] = array( ‘id’ => get_post_meta($p->ID, ‘_sbap_pointerid_text’, … Read more

Use a select box to change a php variable

To store the user defined value into the DB you can use the update_user_meta() function. And retrieve back the info with get_user_meta(). You could update the the user meta key with an AJAX call on your select change or put your select in a form and update on form submit either with $_GET or $_POST … Read more

global categories – Share specific categories in wordpress multisite

Here is a solution I found- // even before any taxonmy/terms are initialized, we reset the tables add_action( ‘init’, ‘the_dramatist_change_tax_terms_table’, 0 ); // on blog switching, we need to reset it again, so it does not use current blog’s tax/terms only // it works both on switch/restore blog add_action( ‘switch_blog’, ‘the_dramatist_change_tax_terms_table’, 0 ); function the_dramatist_change_tax_terms_table(){ … Read more

Need data from two different actions

Try $globalres=””; add_action(‘quiz_completed’, ‘mi_ld_quiz_ert’, 10, 2); function mi_ld_quiz_ert( $quizdata, $current_user ) { global $globalres; if($globalres== 0){ do_action(‘ld_update_group_access’, $current_user, 2, $remove = false )); } else{ do_action(‘ld_update_group_access’, $current_user, 14, $remove = false )); } } add_action(‘learndash_ques_single_answer_correct’, ‘my_ld_quiz_resp’,5,5); function my_ld_quiz_resp( $answerIndex, $correctAnswer, $userResponse) { global $globalres; $globalres = $answerIndex; }

Get variable from previous blog while using switch_to_blog

Your code, which I assume is in a function, should pass variables needed from the current blog. So, assuming that your code in your question is called by somefunction(), change that to pass along variables from the current blog, as in // variables from the current blog $current_blog_1 = “some value” $current_blog_2 = “another value” … Read more