简体   繁体   English

如何在Wordpress中编辑提交按钮?

[英]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. 我想在wordpress adminpanel中的media.php部分的提交按钮上添加onclick属性。 Where can I edit this button in Wordpress? 我在哪里可以在Wordpress中编辑此按钮? It only writes out <?php submit_button( __( 'Update Media' ), 'primary', 'save' ); ?> 它只写出<?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 . <?php submit_button( __( 'Update Media' ), 'primary', 'save' ); ?> ,我找不到一种方法来编辑HTML以添加我的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($text, $type, $name, $wrap, $other_attributes)位于第2169行的/wp-admin/includes/template.php文件中

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. submit_button(..)然后对位于第2190行的同一文件中的get_submit_button($text, $type, $name, $wrap, $other_attributes)进行get_submit_button($text, $type, $name, $wrap, $other_attributes)

Unfortunately there is no apply_filters to modify the output of the WordPress. 不幸的是,没有apply_filters可以修改WordPress的输出。 In that case you have to make changes in the WordPress core files. 在这种情况下,您必须在WordPress核心文件中进行更改。 I do not suggest you make any change in the WordPress core files, because on next update you will lose that changes. 我不建议您对WordPress核心文件进行任何更改,因为在下一次更新时,您将丢失这些更改。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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