How to add year and month path to old attachment images?

If you want to change the post thumbnail URL, use the filter wp_get_attachment_url; Try to follow the next code: // NAV: Change the url for thumbnail for post function wpcoder_change_post_thumbnail_url($url, $post_id) { if (strpos($url, ‘img/uploads/’) !== false) { $year = date(‘Y’); // Year folder $month = date(‘m’); // Month folder $url = str_replace(“img/uploads/”, “app/uploads/’.$year.”https://wordpress.stackexchange.com/”.$month.’/”, $url); … Read more

How to remove the hyperlink from all post dates where when you mouseover over the post date, a hyperlink displays like- “…com/2023/08/“

You can use the Site Editor. For the TwentyTwentyThree theme, you can find the option to disable the link with the steps below. A different template my require a different path through the template blocks or a child theme as suggested by Jacob Peattie in the Comments. Single posts Navigate to the Site Editor page … Read more

wp_update_post breaks my function

Found the answer thanks to Jacobs comments + this similar thread: I had to use remove_action() WITH matching priority, like this: function booking_meta( $post_id, $post, $update ) { if ( get_post_type( $post_id ) !== ‘booking’ ) { return; } // Update ACF fields $object_id = get_the_ID(); $owner_id = get_the_author_meta( ‘ID’, $post->post_author ); update_field( ‘object’, $object_id, … Read more

Changing a class state in a wordpress plugin

Is this the right approach to have this kind of behaviour? No, this kind of behaviour requires a persistant running application that stays in memory, like a NodeJS application, but that’s not how PHP works. But only updateMembershipPricing does not update the values for an underlaying class MembershipDuration. It does! But the important thing to … Read more