Hot answers tagged

3

Shouldn't the 2nd argument be a function? The second argument should be a value of type callable. callables are a fundamental type in PHP. E.g. these are some valid callables: Value Equivalent 'test' test() [ $obj, 'test' ] $obj->test() [ 'foo', 'bar' ] foo::bar() function() {...} or closure $foo = function(){...}; $foo(); And so on, see the ...


1

I just try to add some content at the bottom of each posts from a specific category but the content is added in all posts. Are you sure your "Hello World!" text is added in all posts? Because is_single() && is_category() would never be true because a query can't be for a single post and a category archive at the same time. 🤔 So if you ...


1

So I managed to cobble something together with a bit of javascript... It's hacky but somewhat elegant I think. add_action('admin_init', function () { if ( current_user_can("send_notifications") ) { $post_types = ["post", "go_live"]; foreach ($post_types as $post_type) { add_meta_box( ...


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