Disable auto-save and post revisions from inside a theme or plugin

You mentioned: Is there a way, to do that from within a plugin or a themes functions.php? You may want to try the following code. Just place it inside your theme’s functions.php file. Using it, you do NOT have to alter the wp-config.php file. define(‘WP_POST_REVISIONS’, false); function disable_autosave() { wp_deregister_script(‘autosave’); } add_action(‘wp_print_scripts’, ‘disable_autosave’);

Update Post Meta is adding a value to my serialize array

This happens when an already serialized string get serialize again. Replace $categories = serialize($_POST[“vibe_quiz_tags”]); with $categories = $_POST[“vibe_quiz_tags”]; EDIT: As mentioned by czerspalace in the comments, the Function Reference for update_post_meta states that “this should be raw as opposed to sanitized for database queries”.

Why I can not I use the variable outside my function?

The problem here is order, the $post variable isn’t available from the moment WordPress is loaded, it needs to process the request, put together a database query, and retrieve the post first. Time travel is necessary for your code to work as you expected. Your themes functions.php and plugins will be loaded before this happens … Read more

Conditional Tag for has post [closed]

I am not familiar with the plugin, but it seems unlikely that the $conditions array you’re adding to should contain any variety of WordPress query arguments. Further, referencing the $conditions array within a property that you’re setting on that very array won’t contain the new data you’ve added, but rather the array as it existed … Read more

Why my wp_posts data is so huge?

No, that isn’t normal for 23 posts. Note that “posts” is pretty wide concept in modern WordPress. Many things are posts without being obvious as such, for example parts of navigation menus. While 60k entries does sound excessive for a small site, there is no telling without examining actual data to determine which post types … Read more

Adding bootstrap classes to video shortcodes

This is how I bootstrapped youtube embeds in one of my projects. /** * Responsive Youtube embeds. */ add_filter( ’embed_oembed_html’, function( $html, $url, $attr, $post_ID ) { if ( false !== stripos( $html, ‘<iframe ‘ ) && false !== stripos( $html, ‘.youtube.com/embed’ ) ) { $html = sprintf(‘<div class=”embed-responsive embed-responsive-16by9″>%s</div>’, $html ); } return $html; … Read more