I have a wordpress page. In that WordPress page, user will have access to the following Window to Publish
their Post in to the webpage.
If the user enters an URL in any of the three filed I have marked in red above, my php code will look in to those URLs and determine if they are spam or not. Therefore, I want to put my php code inside the Publish
button, so I can either disallow or allow the post after my php code run and determine if those URLs are spam or not. Can you please tell me the name of the wordpress file I should edit in order to put my php code in. I am new to wordpress and don’t know too much about their file structure.
NEVER edit core files. it is the worst practice that you can choose when working with a ready made cms / publishing system
you need to filter or hook into some action, there are several ones that are triggered when a post is published ,
for example the wp_insert_post_data
fires when the info is INSERTED to the DB .
add_filter ( 'wp_insert_post_data' , 'my_filter_function' , 99 );
publish_post
is when a post is published, or if it is edited and its status is "published". pre_post_update
Runs just before a post or page is updated.
And so on. see the codex page in the link above to read more about actions
, filters
and hooks
.
And just so You will not forget : NEVER edit core files.