hook add_attachment cannot complete its work

Good afternoon!

I need to clear everything fields when inserting an image in the WordPress loader.

On the Internet, I found a function:

    function my_set_image_meta_upon_image_upload( $  post_ID ) {        if ( wp_attachment_is_image( $  post_ID ) ) {          $  my_image_meta = array(           'ID'           => $  post_ID,           'post_title'   => '',           'post_excerpt' => '',           'post_content' => '',         );          update_post_meta( $  post_ID, '_wp_attachment_image_alt', '' );          wp_update_post( $  my_image_meta );       }     }     add_action( 'add_attachment', 'my_set_image_meta_upon_image_upload' ); 

It clears the fields but does not show the image (see the image):


How can this be fixed?


Is this homebrew Misty Hook spell balanced?

In a game I play, my GM allows a lot of custom homebrew (with approval), including spells. A situation has come up where my sorcerer is trying to make a version of Misty Step pulling a nearby creature to you, instead of teleporting to a nearby space.

My GM doesn’t have much of an opinion on it yet, so I want advice for balancing it.

This is the spell text:

Misty Hook
3rd level conjuration
Range: 30 feet
Choose one creature you can see within 30 feet of you. You teleport them to an unoccupied space of their choice within 5 feet of you. An unwilling creature can make a Wisdom save to avoid being teleported.

Is this balanced as a 3rd level spell, or should it be higher level?

Note: I’ve been talking about this in chat here, scroll down for the full discussion.

What do you think of 1/session items? Or help me find a better way to solve this plot hook. I’m stumped

I wanted to give my players a homebrew item, but I’m having a hard time balancing it around in-game / in-universe limitations. Normally this is like 1/day, 1/encounter etc.

I was thinking of doing 1/session (once per d&d session). Is that too meta?

For specifics, this item is a tome of knowledge which will allow them to ask some # of questions (I’m thinking 2) per [some time frame]. The books knows everything its previous owners knew. I’m doing this so my players have an in game mechanic to help them find the items they need to take down the BBEG.

Alternatively, if you have a suggestion how my players can find the ‘x old artifacts’ that legend says are needed to kill the BBEG that would work too. I’m trying to have them find something to help them find the artifacts without an in game person just telling them where they all are or just having them wander into the items randomly (both of which don’t seem satisfying).

‘woocommerce_add_to_cart_redirect’ hook stopped working

I am trying to redirect directly directly to checkout when user hits “add to cart” and my code worked before but somewhere along the way it stopped working and I cannot pinpoint why.

add_filter( 'woocommerce_add_to_cart_redirect', 'rd_redirect_checkout_add_cart' );  function rd_redirect_checkout_add_cart() {    return wc_get_checkout_url(); } 

So now when i hit add to cart, the page refreshes, the item gets added to cart and that is about it. If i hit it again, it again refreshes and adds to cart. No redirection happens. this is the url site.com/?add-to-cart=499

I have tried disabling all plugins, removed the redirect code, and used redirect plugin, tried everything and dont know what else to do.

Any ideas would be helpful. Thanks.

WordPress hook after post content and meta update

I want to update one of my meta field and redirect and I am using post_updatedhook. Here is my code.

function job_publish_status( $  post_ID, $  post_after, $  post_before ) {    $  job_published_date = get_the_time("Y-m-d", $  post_ID);    $  expire_date = date('Y-m-d', strtotime($  job_published_date. ' + 60 days'));    update_post_meta($  post_ID, '_job_expires', $  expire_date);    $  url = get_site_url();    $  url = $  url.'/wp-admin/post.php?post='.$  post_ID.'&action=edit';    wp_redirect( $  url );    exit;  } add_action('post_updated', 'job_publish_status', 99, 3 ); 

It is updating this _job_expires meta field and redirecting correctly. When I edit post content and title, its updates title and content but it is not updating other meta fields in this post. Is there any hook which triggers after post content update and meta fields update ?

Is there any hook or filter that user data, specifically email address, is passed through on new order creation?

I want to create a function/module that corrects common email typos on new orders.

For example to auto correct gmail.con, hotmail.con to .com, and many many more common typos.

Is there any hook or filter that user data, specifically email address, is passed through on new order creation, so that we can modify it before it’s inserted into the database?

Execute Hook on the footer or header after activating a plugin

I have the following code fraction, but it does not work, I want that after activating a plugin this calls an action on the footer and prints something, but I can’t do it, the problem seems that the admin_footer does not run, I don’t know if activated_plugin is just before or after the html is printed so that the admin_footer, or how could I fix it?

add_action( 'activated_plugin', 'admin_activated_plugin' ); function admin_activated_plugin(){   // up to here if you run ....   // but   // the hook below doesn't   add_action( 'admin_footer', 'after_activate_print_footer', 99 ); } function after_activate_print_footer(){  echo "something"; } 

In conclusion, I want to print a text in the header or footer just after a plugin is activated