Metaboxes – why they don’t render php in expected manner?

The whole page/post/custom post type post screen is a big form. That means that whenever you hit “publish” on a post type edit screen, the whole form – and that means every content on the page – gets processed and WordPress executes everything. And that “everything” includes all kinds of hooks that you should use to save, sanitize, etc. your meta box contents. Use to following plugin to give it a try:

<?php
/* Plugin Name: WPSE (#168617) Dump $_POST on post edit screen */

add_action( 'save_post', function()
{
    # Uncomment to see $_POST data
    // exit( var_dump( $_POST ) );

    // Save as Post Meta Data
    update_post_meta();
} );

For more info on post meta data handling, see update_post_meta() and the Related Section in Codex.

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)