Custom embed shows on posts but not on category pages

I added a custom embed handler for brightcove since one doesn’t exist.

It works fine on the post itself and the video loads, but just shows a linked url on category and blog roll pages. I am setting the post type to Video because I’d like that to be the featured image. Here’s what I have:

add_action( 'init', function() { wp_embed_register_handler(     'brightcove',     '#https?://players\.brightcove\.net/([^/]+)/([^/]+)/index.html\?videoId=([\d]+)#',     'wp_embed_handler_brightcove'  ); } );  function wp_embed_handler_brightcove($  matches, $  attr, $  url, $  rawattr) {    $  account  = esc_attr($  matches[ 1 ]); $  player   = esc_attr($  matches[ 2 ]); $  video_id = esc_attr($  matches[ 3 ]);  $  embed = '<div style="position: relative; display: block; max-width: 100%;"><div style="padding-top: 56.25%;"><iframe src="' . sprintf('$  s/%2$  s/index.html?videoId=%3$  s',           $  account,           $  player,           $  video_id ) . '" allowfullscreen="" allow="encrypted-media" style="position: absolute; top: 0px; right: 0px; bottom: 0px; left: 0px; width: 100%; height: 100%;"></iframe></div></div>';    return apply_filters('embed_brightcove', $  embed, $  matches, $  attr, $  url, $  rawattr); 


Any input is appreciated.

How to exclude a category returned by get_categories from function.php?

I have a plugin that create my website sitemap. It starts by getting all categories with get_categories and then gets all pages for each. However I have one category that must not be included then I did that in the plugin code:

$  args['exclude']=2; $  cats = get_categories( $  args ); 

The problem is that if the plugin replace the file my modiofication will be deleted, I tried with that:

function exclude_cat($  taxonomy, $  args) {          $  args['exclude']=2;     return $  args; }  add_filter('get_categories_taxonomy', 'exclude_cat', 10, 2); 

But then no category is returned at all, I think I’m not using it correctly but I don’t find examples.

If a product category is then display code in product short description

How to display a specific code in a product short description if it is belong to a specific category, i’ve used below code in function to add the code but it is displaying on all products.

    function herara_filter_short_description( $  desc ){     global $  product; if ( is_single( $  product->id ) )         //$  new_desc = 'SKU: ' . $  product->get_sku();         $  new_desc = '<span class="sku_wrapper">SKU: <span class="sku">'. $  product->get_sku() .'</span></span></BR><span class="material_wrapper">MATERIAL: <span class="material">'. $  product->get_sku() .'</span></span>';         //$  new_desc .= $  desc;     return $  new_desc; } add_filter( 'woocommerce_short_description', 'herara_filter_short_description' ); 

Rewrite rule for changing permalinks. Post name to permalink with Category


  1. I have an wordpress site that has existing posts.

  2. Permalink structure is currently configured to

  3. I need to change the Permalink structure to but when I save these settings results to 404 does not redirect to

  4. When I remove the /%category%/ and just use the 301 redirection from works fine

Is there a better way to achieve changing to with proper redirections from

Note: I already deactivate all plugins and just used the default twentytwenty theme. I have 11,000 existing posts.

SCENARIO B (if Scenario A does not work or there is no solution to Scenario A. Im looking at option Scenario B)

  1. The existing posts are under a category called "Local News", "local-news"
  2. Is there a way where I can just filter the rewrite rule so that if a post is under "Local News" category then the permalink structure will be then all other new posts will follow the main permalink structure I have set which is ?

Currently I have this but I’m not sure it’s working properly. When I apply this it seems to work for posts that are under "Local News" category. However it breaks my PAGES. PAGES result in 404s.

function custom_permalink( $  permalink, $  post, $  leavename ) {     // Get the category for the post     $  category = get_the_category($  post->ID);     if (  !empty($  category) && $  category[0]->cat_name == "Local News" ) {         $  cat_name = strtolower($  category[0]->cat_name);         $  permalink = trailingslashit( home_url('/' . $  post->post_name .'/' ) );     }     return $  permalink; }  add_action( 'init', 'custom_rewrite_rules' ); function custom_rewrite_rules() {     add_rewrite_rule(         '([^/]+)(?:/([0-9]+))?/?$  ',         'index.php?category_name=local%news&name=$  matches[1]&page=$  matches[2]',         'top' // The rule position; either 'top' or 'bottom' (default).     ); } 

Is this a correct approach or is my code correct? I’m also not sure if the rewrite rules I made affects other things. Basically I just want to retain permalink/url of the old posts and moving forward I want to follow the new permalink settings. I’m avoiding old posts to result in 404 pages.


Get category link to widget

I add this code and is working good, but open different category link, Any idea?

    $  category = get_the_category();  if($  category[0]){     echo '<p class="read-more-custom-widget">';     echo '<a href="'.get_category_link($  category[0]->term_id ).'"title="Read More">Read More &raquo;</a>';     echo '</p>'; } 

How to display the number articles with the same tag inside specific category

I am trying to display the tags that are inside of a specific category. I have this working properly but now I want to show the count next to each tag showing how many articles are in that tag. i.e


I have something that is very close but the problem is that if I have two tags inside a category let’s say apples and oranges, both will show (2), because there are 2 tags in that category in general. I want it to show how many of each tag, like Apples(1), Oranges(2) Here is my code:

 <?php   query_posts('category_name=Health');    if (have_posts()) : while (have_posts()) : the_post();     if( get_the_tag_list() ){         echo get_the_tag_list(); echo"(";echo $  wp_query->found_posts;echo")"; echo '<br>';     }     endwhile; endif;     wp_reset_query(); ?> 

Many thanks in advance.

What’s the internal language of the opposite of a Cartesian closed category?

I have heard the simply typed lambda calculus is the internal language of Cartesian closed categories.

What’s the internal language of the opposite type of category?

I have the intuition the opposite category would correspond to continuation passing style or pattern matching but the opposite typing rules seem very strange and hard to figure out.

A monad is just a monoid in the category of endofunctors, what’s the enlightenment?

Pardon the word play. I’m a little confused about the implication of the claim and hence the question.

Background: I ventured into Category Theory to understand the theoretical underpinnings of various categorical constructs and their relevance to functional programming (FP). It seems (to me) that one of the "crowning gems" at the intersection of Cat and FP is this statement:

A monad is just a monoid in the category of endofunctors

What is the big deal about this observation and what are its programmatic/design implications? Sources like sigfpe and many texts on FP seem to imply the mindblowingness of this concept but perhaps I’m unable to see the subtlety that’s being alluded to.

Here’s how I understand it:

Knowing something is a monoid allows us to extrapolate the fact that we can work within a map-reduce setting where the associativity of the operations allows us to split/combine the computation in arbitrary order i.e., (a1+a2)+a3 == a1+(a2+a3). It can also allow one to distribute this across machines and achieve high parallelization. (Thus, I could mentally go from a theoretical construct -> computer science understanding -> practical problem solving.)

For me it was obvious (as a result of studying Cat) to see that monads have a monoidal structure in the category of endofunctors. However, what is the implication one can draw from this and what is its programmatic/design/engineering impact when we’re coding with such a mental model?

Here’s my interpretation:

  • Theoretical Implication: All computable problems at their heart are monoidal in a sense.
    • Is this correct? If so, I can understand the enlightenment. It’s a different perspective on understanding the notion/structure of computable problems that wouldn’t be obvious if coming from only a Turing/Lambda model of computation and I can be at peace.
    • Is there more to it?
  • Practical Implication: Is it simply to provide a case for the do-notation style of programming? That is, if things are monoidal we can better appreciate the existence of the do/for constructs in Haskell/Scala. Is that it? Even if we didn’t know about the monoidal underpinnings, we needn’t invoke the monoidalness to make this claim since bind >>= and flatMap constructs are defined to be associative. So what gives? Or is it more to do with the foldability of monadic constructs and that is the indirect enlightenment that is being alluded to?

Question(s): What am I missing here? Is it simply the recognition of the fact that monads are generalized monoids and that they can be combined in any order similar to map-reduce operations like monoids? How does knowing about the monoidal property help improve the code/design in any way? What’s a good example of before/after to show this difference (before knowing about monads/monoidality and after)?

Google search console consider 404 urls as crawl anomaly category and not 404 not found category

I’ve got a site which we have mention as 404 not found for a few particular pages so that google can consider and push it to Excluded Not found (404) category, but still, google is considering those pages as crawl anomaly category. Please find the screenshot below.

enter image description here

enter image description here