Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange
4

There is an inbuilt function for returning null: __return_null. So you can replace create_function('$a', 'return null;'); with just '__return_null' (note the quotes) as it seems $a is not used anyway. Or you can use an anonymous function as the argument directly: function($a) {return null;} (no quotes). Either way since the argument is expecting a ...


3

You should be able to change create_function( '$a', "return null;" ) to Anonymous Function (aka Closure) : From : add_theme_page( $this->args['page_slug'], __('Dev Mode Info', 'nhp-opts'), __('Dev Mode Info', 'nhp-opts'), $this->args['page_cap'], $this->args['page_slug'].'&tab=...


2

Say that get_author_posts_url(1) return the following URL https://example.com/author/admin/ Passing the $author_nicename will change this. So get_author_posts_url(1, 'foo') will result in https://example.com/author/foo/ You can also check this in the source code of get_author_posts_url(). So what does passing the second argument do? It changes the ...


2

If it's just a list of numbers, I'd suggest just saving them in a text file, with a number on each line. 110019 111222 112233 Then when you need the file, read its contents with PHP, and use preg_split() to turn it into an array: $file_path = plugin_dir_path( 'postcodes.txt', __FILE__ ); // Or wherever you've placed it. $file_contents = ...


1

My include has a handful of custom hooks which handle enqueuing, dequeuing and inserting custom HTML. I'm still not 100% certain what you mean, but if this code is normal WordPress code, with functions and add_action(), and you only want those hooks to run on these events pages, then the proper way to do this would be to include that file into your theme's ...


1

Please check below code : add_action( 'woocommerce_single_product_summary','content_after_addtocart_button' ); function content_after_addtocart_button() { global $product; $product_title = $product->get_name(); $product_price = $product->get_price(); echo '<div class="content-section"> <a href="mailto:riccardoairone@...


1

has_category() only tells you if a specific post has a given category (or any category, if none is provided). You can tell it which post to check by passing the post ID as the second argument. When used inside the loop however, you can omit the post ID and it will check the current post. The problem is that if it's used outside the loop, then the 'current ...


Only top voted, non community-wiki answers of a minimum length are eligible