Why does “get_option” pull in the older value in options.php, rather than the newer value, on submission of a form?

If your update_option call runs after you assign $posts1 and $posts2, then of course they’ll hold the “old” value, even if you sleep for eternity 😉 Either run the update earlier, or (re)assign the variables afterwards. $posts1 = get_option( ‘post1’ ); echo get_option( ‘post1’ ); // [my_id] echo $posts1; // [my_id] update_option( ‘post1’, ‘foobar’ ); … Read more

TCPDF get_post_meta outside the loop

I’ve got it fixed: I needed to add the wp-load file that contains all the WP-functions include(‘../../../../../wp-load.php’); global $post; $id = $_GET[‘id’]; $content_post = get_post($id); $content = $content_post->post_content; $content = apply_filters(‘the_content’, $content); $content = str_replace(‘]]>’, ‘]]>’, $content); Now the content loads in the PDF

Changing Link Attributes for Wp_Link_Pages

There is no filter for the URLs, and no filter for the complete output of wp_link_pages(). But you can get the output as string if you pass ‘echo’ => FALSE as argument. There are four options: Write a modified copy of the function with the URLs you need. You will miss all further improvements which … Read more

Adding php directly into widget shortcode

To be honest, if you see yourself in the need of adding executable PHP code into a shortcode attribute, or in content editor in general, you are doing something wrong. You should think again about what, why and how do it. There is a high security risk accepting executable PHP code form user inputs. Instead, … Read more

Setting up the child theme so as to enable right-to-left WordPress?

You also need to include the RTL.css file which is in the theme too: add_action( ‘wp_enqueue_scripts’, ‘my_theme_enqueue_styles’ ); function my_theme_enqueue_styles() { wp_enqueue_style( ‘parent-style’, get_template_directory_uri() . ‘/style.css’ ); wp_enqueue_style( ‘rtl-style’, get_template_directory_uri() . ‘/rtl.css’ ); } To use the rtl.css from your theme directory change the code to: add_action( ‘wp_enqueue_scripts’, ‘my_theme_enqueue_styles’ ); function my_theme_enqueue_styles() { wp_enqueue_style( ‘parent-style’, … Read more

append PHP function to the_content

You will need to experiment with priority. add_filter( ‘the_content’, function($content) { return ‘text-to-append’ . $content; }, 10 // this is a priority number; 10 is default ); The “10” is the default priority. I don’t know what number JetPack uses but your original code, without a priority, should run at “10” so I’d try “9”, … Read more