简体   繁体   中英

How do I edit a submit button in Wordpress?

I want to add an onclick attribute to the submit button of the media.php section in wordpress adminpanel. Where can I edit this button in Wordpress? It only writes out <?php submit_button( __( 'Update Media' ), 'primary', 'save' ); ?> <?php submit_button( __( 'Update Media' ), 'primary', 'save' ); ?> and I can't find a way to just edit the HTML to add my onclick .

The function submit_button($text, $type, $name, $wrap, $other_attributes) is located in the /wp-admin/includes/template.php file on line 2169

submit_button(..) It then does a call on get_submit_button($text, $type, $name, $wrap, $other_attributes) which is located in the same file on line 2190.

Unfortunately there is no apply_filters to modify the output of the WordPress. In that case you have to make changes in the WordPress core files. I do not suggest you make any change in the WordPress core files, because on next update you will lose that changes.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM