Odd map_meta_cap $args on post edit — sometimes integer, sometimes string

The map_meta_cap function handles context arguments generically – you can give it anything and it’ll happily pass it down the chain. It’s only particular capabilities like edit_post that expect the argument to be an integer, but even then it’s up to the caller to pass an appropriate value. Here’s where you get your string/integer mashups … Read more

How to replace default comments with custom HTML?

Note that with the following: add_filter (‘comments_template’, ‘fbcommentbox’, 100); we expect fbcommentbox() to return the path to the new comments template file. The default is the path of comments.php. If you create the fbcommentbox.php file in your theme, then you could try: add_filter( ‘comments_template’, ‘fbcommentbox’, 100); function fbcommentbox( $theme_template ) { // Path to our … Read more

Multiple API Endpoints (wp_remote_get)

You could write a function to pull both the responses. Then merge the results based on a successful result. This assumes the result for both calls is json data and should be converted to an array. I’m also using the same function calls you supplied so adjust the second where needed. function get_json_data_from_2apis($api1_data = array(), … Read more

term_exists() returning NULL on term that exists

The third argument for term_exists() is an integer, not an array. Parameters $term (integer|string) (required) The term to check Default: None $taxonomy (string) (optional) The taxonomy name to use Default: ” $parent (integer) (optional) $parent ID of parent term under which to confine the exists search Default: 0 Pass the correct arguments and it works. … Read more