how to check if an element in an html file exists in another html file? [closed]

If I understand you correctly, and you want to find an HTML element inside another page, you need to use some HTML parser. Take a look at https://www.php.net/manual/en/domdocument.loadhtmlfile.php or https://github.com/paquettg/php-html-parser. I believe there are more tools that can help you with this. On page B you load page A as a remote document by URL, … Read more

How to update an image attachment’s alt text from a custom field when saving a post?

I found the problem. It was updating the post instead of the attachment. So instead of $post->ID, I create another string that stores the image ID and replace that with post->ID and it works. function post_extra_save( $post_id, $post){ if ( has_blocks( $post->post_content ) ) { $blocks = parse_blocks( $post->post_content ); foreach ( $blocks as $block … Read more

page shows short code not output

I change the array in get_children() and foreach loop with below reference url and code work fine. please check the argument that you have passed also use echo statement like they shown in the example. reference url : https://developer.wordpress.org/reference/functions/get_children/ let me know result or errors $args = array( ‘posts_per_page’ => 1, ‘order’ => ‘ASC’, ‘post_mime_type’ … Read more