Invoke a function before the action hook

For this specific problem you can use Rilwis metabox plugin, where you can define custom metabox along with the validation.

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