WordPress $GLOBALS and PHP $GLOBALS
WordPress $GLOBALS and PHP $GLOBALS
WordPress $GLOBALS and PHP $GLOBALS
I ran a test and the following works: global $testMe; $testMe = 0; function my_acf_update_value( $value, $post_id, $field ) { global $testMe; $testMe = $value; return $value; } add_filter(‘acf/update_value/key=field_5308e5e79784b’, ‘my_acf_update_value’, 10, 3); // Test: Apply the filter apply_filters(‘acf/update_value/key=field_5308e5e79784b’,’a’,’b’,’c’); // end Test echo $testMe; // prints ‘a’ So, in principle, your code is functional. There are … Read more
You could just get the permalink and strip the home root from it- $path = substr( get_permalink(), strlen( home_url(“https://wordpress.stackexchange.com/”) ) );
You can turn your snippet into a function that returns the post thumbnail URL of a post: function wpse81577_get_small_thumb_url( $post_id ) { $thumbSmall = wp_get_attachment_image_src( get_post_thumbnail_id( $post_id ), ‘small’ ); return $thumbSmall[‘0’]; } Usage, supplying the ID of a post: <?php echo wpse81577_get_small_thumb_url( 59 ); ?>
Sessions in plugin development?
How to load post_meta for custom post type via Ajax
Add notice to add image popup
On top of my head scheme like this should work: // functions.php function prefix_get_settings() { return array(‘haha’ => ‘hehe’); } add_filter( ‘prefix_default_settings’, ‘prefix_get_settings’, 9 ); // plugin $default_settings = apply_filters( ‘prefix_default_settings’, array() );
Here is the solution I came up with using options. Thanks for the advice this worked well for my use case. <?php // This function sends the http request that purges my cdn cache. function hw_cdn_purge() { // My http request code goes here. // After the request the purgeCdnResult variable is set to the … Read more
Best way to access variables in template markup