从插件文件中禁用主题和插件更新

I have used add_filter( 'pre_site_transient_update_plugins', create_function( '$a', "return null;" ) ); and

add_filter( 'pre_site_transient_update_themes', create_function( '$a', "return null;" ) ); or define('DISALLOW_FILE_MODS', true );

in my theme functions.php or wp-config.php to disable themes/plugins updates or hide admin side theme/plugin editor.

I want to implement these functionality into my custom plugin and when i putted these hooks in my plugin file. It didn't work.
Please help me out how can i implement these hooks in my plugins so it could disable theme/plugin updates.