在Wordpress v4.0文件/wp-includes/js/wplink.js第200行,我想通过WordPress插件将我自己的js排队,并将函数 htmlUpdate 重新定义为修改它的功能。什么是正确的方法?
PS:我很喜欢使用enqueing脚本等。只需要帮助解决如何使用我自己的插件覆盖功能。
htmlUpdate: function() {
//... blah blah
}
答案 0 :(得分:0)
您可以尝试这样:
add_action( 'admin_footer-post-new.php', 'my_custom_method', 9999 );
add_action( 'admin_footer-post.php', 'my_custom_method', 9999 );
function my_custom_method() {
?>
<script type="text/javascript">
( function( $ ) {
if ( typeof wpLink == 'undefined' )
return;
// Override the function
wpLink.htmlUpdate= function () {
//... blah blah
};
} )( jQuery );
</script>
<?php
}
希望这就是你要找的......