Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I would like to change the text in the wp media uploader. I managed to find the function at the media.php and i tried to using the filter to change the text like this:

function uploader_text() {
remove_action('post-html-upload-ui', 'media_upload_html_bypass' );
?>
<p class="upload-html-bypass hide-if-no-js">
<?php _e('mytext here'); ?>
</p>
<?php
} 
 add_filter('post-html-upload-ui', 'uploader_text');

But I failed to do so. What I done wrong?

Update: This is how I tried

The related function in wp is like this:

    <div id="html-upload-ui" class="hide-if-js">
            <?php do_action('pre-html-upload-ui'); ?>
                <p id="async-upload-wrap">
                    <label class="screen-reader-text" for="async-upload"><?php _e('Upload'); ?></label>
                    <input type="file" name="async-upload" id="async-upload" />
                    <?php submit_button( __( 'Upload' ), 'button', 'html-upload', false ); ?>
                    <a href="#" onclick="try{top.tb_remove();}catch(e){}; return false;"><?php _e('Cancel'); ?></a>
                </p>
                <div class="clear"></div>
            <?php do_action('post-html-upload-ui'); ?>
            </div>


        function media_upload_html_bypass() {
            ?>
            <p class="upload-html-bypass hide-if-no-js">


<?php _e('You are using the browser&#8217;s built-in file uploader. The new WordPress uploader includes multiple file selection and drag and drop capability. <a href="#">Switch to the new uploader</a>.'); ?>
            </p>
            <?php
        }
        add_action('post-html-upload-ui', 'media_upload_html_bypass');

The text that i need to change is in media_upload_html_bypass() :

<?php _e('You are using the browser&#8217;s built-in file uploader. The new WordPress uploader includes multiple file selection and drag and drop capability. <a href="#">Switch to the new uploader</a>.'); ?>

So I tried :

function uploader_text() {

                ?>
                <p class="upload-html-bypass hide-if-no-js">
                <?php _e('here is what i want to change the text</a>.'); ?>
                </p>

                <?php

                } 
            add_filter('media_upload_html_bypass', 'uploader_text');

Still not working.

share|improve this question
    
Which text are you exactly trying to change? A screen shot could help. –  Rutwick Gangurde Apr 18 '12 at 13:05
add comment

2 Answers

up vote 0 down vote accepted

This worked for me:

function uploader_text() {
    ?>
<p class="upload-html-bypass hide-if-no-js">
    <?php _e('mytext here'); ?>
</p>
    <?php
}

remove_action('post-html-upload-ui', 'media_upload_html_bypass');
add_action('post-html-upload-ui', 'uploader_text');

You tried to do "remove_action" after the action already happened. That was the bug.

share|improve this answer
    
Nope,the original texts is still there...this only add the new text...seem the remove_action('post-html-upload-ui', 'media_upload_html_bypass'); is not working –  dev-jim Apr 18 '12 at 16:47
    
Ok...I found out the solution. Turns out it need to add the remove_action('post-html-upload-ui', 'media_upload_html_bypass'); into admin_init....anyway thanks.. –  dev-jim Apr 18 '12 at 16:53
    
@tc.k could you add this as answer and accept after 24 hours? –  Stephen Harris May 1 '12 at 13:51
add comment

The 'post-html-upload-ui' is an action, not a filter. So it should be: add_action instead of add_filter.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.