My JS script runs on every page, but I want it to run only on the post editor page.
function sm_validate_title() {
echo "
<script>
console.log('script working')
...code to validate title and content
</script>";
}
add_action('admin_footer', 'sm_validate_title_client_side');
Maybe I should try a different hook? or add some condition on the callback function? I don't know really which hook would work, there are so many, and no idea also on how to check if page == post page with JS.