Grab meta data before post is saved
Grab meta data before post is saved
Grab meta data before post is saved
After some more research I found a solution, turned out that I had to use admin_init.. function pg_save_custom_site_options(){ global $pagenow; if( ‘site-info.php’ == $pagenow && isset($_REQUEST[‘action’]) && ‘update-site’ == $_REQUEST[‘action’] ) { if ( isset( $_POST[‘blog’][‘custom_limit_amount’] ) ) { $new_field_value = intval( $_POST[‘blog’][‘custom_limit_amount’] ); if( is_int($new_field_value) ){ update_blog_option( $_POST[‘id’], ‘custom_limit_amount’, $new_field_value ); } } } … Read more
Hooks with same priority number. Can one stack items returned in divs, position: absolute each with their own z-index?
What action/hook do I need to register to have my plugin handle front-end editing?
Since any attribute added to <br> tag, including class names and data-attrs keeps them from stripping, quick and incomplete way could be: function filter_function_name( $content, $post_id ) { $content = str_replace(‘<br>’, ‘<br data-x>’, $content); $content = str_replace(‘<br >’, ‘<br data-x>’, $content); $content = str_replace(‘<br />’, ‘<br data-x>’, $content); $content = str_replace(‘<br/>’, ‘<br data-x>’, $content); return … Read more
add_action( ‘woocommerce_view_order’, ‘before_woocommerce_order_details’, 5 ); function before_woocommerce_order_details($order_id){ $order = new WC_Order($order_id); echo “Order Status : “.$order->get_status(); }
You can use transition_post_status: add_action(‘transition_post_status’, ‘wpse_handle_untrash’); function wpse_handle_untrash($new_status, $old_status, $post) { // if the post was in the trash, but now is not if($old_status == ‘trash’) { // if you want, you can do something only for a certain post type if($post->post_type == ‘my-desired-post-type’) { // do something echo ‘<script>alert(‘ . $post->ID . ‘);</script>’; } … Read more
I figured it out by looking in WP Core. When you update a post it actually takes you back to the edit posts screen (post.php) with a GET parameter of message=1. And then it erases that parameter from the url with javascript quickly. So you can find out if posts were uploaded in a plugin … Read more
You just use a normal if statement around the notice so that it only appears if the value of your option matches the current date. function wpse_277689_admin_notice() { if ( get_option( ‘expiry_date’ ) === date( ‘d/m/Y’) ) : ?> <div class=”notice notice-success is-dismissible”> <p><?php _e( ‘Done!’, ‘sample-text-domain’ ); ?></p> </div> <?php endif; } add_action( ‘admin_notices’, … Read more
If i understand, You simply want to have all html from page. Why just don’t do a request to the page in response You have html. Here is the suggestion from codex: /** @var array|WP_Error $response */ $response = wp_remote_get( ‘http://www.example.com/index.html’ ); if ( is_array( $response ) && ! is_wp_error( $response ) ) { $headers … Read more