Hot answers tagged

2

I tried to replicate your issue and while the dev tools show it as alt the source code shows alt="", so WordPress is not stripping the quotes, it's just the dev tools being concise. But even if it was, they're equivalent so alt and alt="" are the same. As for why the dev tools display alt, it's because the dev tools don't display the HTML,...


1

Your problem can be solved using CSS and a small filter. Your proposed solution is not viable. You can check the attributes of some blocks but changing those attributes will not re-render the block if its HTML was generated by javascript. This means the majority of the standard blocks cannot be modified this way, and modifying the class attribute will not ...


1

This code worked for me: function alterImageSRC($image, $attachment_id, $size, $icon){ if ( is_front_page() ) { return $image; } $image[0] = 'http://newimagesrc.com/myimage.jpg'; return $image; } add_filter('wp_get_attachment_image_src', 'alterImageSRC', 10, 4);


1

Your conditional is in trouble. get_the_category() returns an object, use foreach to find the specific category. In addition, you assigned a value to the $categories variable, to compare you must use the comparison operators ( Ex: == or === ) I refactored the code and adapted it to your case, I hope it helps. add_action( 'save_post', 'wp_force_featured_image'...


1

<img src="<?php echo get_template_directory_uri().'/images/sample.png'; ?>"> Try this. It should work. You have to concatenate the results from get_template_directory_uri() and your images directory in echo.


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