Disable autosave with `function.php` for custom post wordpress?

There are a few methods to disable autosave/revisions. Disabling autosave: Using action and dequeuing the .js that is responsible for autosave, this goes into functions.php, located in the current theme directory. function bt_disable_autosave () { wp_deregister_script(‘autosave’); } add_action(‘admin_init’, ‘bt_disable_autosave’); Using a constant to set the interval so high (one day) it will never happen unless … Read more

Get slug of current category in functions.php

get_queried_object is how you retrieve the term for the current category, although you have to be careful to check for this, as it may not be a category archive. It could be a date archive, or a tag archive, etc etc At a minimum you should include an is_category check: https://developer.wordpress.org/reference/functions/is_category/ Reading the docs for … Read more

Message notification for user

You need to use wp_ajax action to callback your function. add_action( ‘wp_ajax_update_last_seen_value’, ‘update_last_seen_value’ ); function update_last_seen_value() { global $wpdb; $table=”ej_users”; $id = $_POST[‘id’]; $meta_value = date(‘Y-m-d H:i:s’); update_user_meta( $id , ‘last_seen’, $meta_value ); $data = array( “status” => ‘success’ ); echo json_encode($data); die(); } I have used your code and made correction to render scenario … Read more

Echo youtube code from url or shortcode

Hi @Саша Стефано: Maybe I’m missing something but at first glance it looks like you just need to add a return statement (I’ve not tested this code so if that’s not it let me know and I’ll dig in to figure it out): function get_youtube_kod($post_id=null) { // Get the post ID if none is provided … Read more