WordPress.org

Ready to get started?Download WordPress

Forums

WordPress 3.1 - Potential WYSIWYG Bug (7 posts)

  1. ctlockey
    Member
    Posted 3 years ago #

    In the last version of WP (I think I was using 3.0.3) I could add shortcode in the WYSIWYG link editor for internal links (e.g. [site-url]/my-internal-page-link) and then go back and edit these links with the WYSIWYG if needed, and exactly what I typed would still be intact.

    In WP 3.1, however, it changes the URL displayed in the WYSIWYG when you edit it to something more like http://www.example.com/wp-admin/%5Bsite-url%5D/my-internal-page-link.

    It would be great if the new link editor would not do this. Don't know if this is a bug or not, but it is annoying.

    (And for anyone who is wondering why I choose to do this - I'm re-launching old, crappy sites and have to develop the new WP sites in a sub-directory then move it on launch, and would rather not have to update every internal link and image src on the site when I launch. - Of course, if there's an easier solution for this, I'd love to hear it.)

  2. It sounds like [site-url] isn't a valid shortcode. Was this a plugin that created it? I've never heard of it, and Google fails me...

  3. ctlockey
    Member
    Posted 3 years ago #

    I created it in my functions.php following the instructions on the codex.

    // [site-url]
    function siteUrl_func( $atts ) {
    	return home_url();
    }
    add_shortcode( 'site-url', 'siteUrl_func' );

    my inspiration: http://codex.wordpress.org/Shortcode_API

    Is this not something we can do? It works when I use it, even with the WYSIWYG, just goofs up when I try to edit...

  4. Huh. I can't repro that with built in shortcodes (like [gallery])

    (And for anyone who is wondering why I choose to do this - I'm re-launching old, crappy sites and have to develop the new WP sites in a sub-directory then move it on launch, and would rather not have to update every internal link and image src on the site when I launch. - Of course, if there's an easier solution for this, I'd love to hear it.)

    How SQL savvy are you? I just tend to move it all and then search/replace my SQL.

  5. ctlockey
    Member
    Posted 3 years ago #

    I'm not horrible with SQL, and saw that suggestion elsewhere, but didn't know how to get into selecting/finding/replacing from multiple tables with one command. (Don't want to replace anything I shouldn't and break the whole thing...)

    Could you recommend a generic query that I could use to base my queries off of? That would be tons easier than editing the URL every time I create an internal link with WP3.1's sweet new "existing content" WYSIWYG editor.

    Thanks for your help, BTW.

  6. http://digwp.com/2010/03/remove-replace-content-wordpress-database/ is a great resource :)

    UPDATE wp_posts SET post_content = REPLACE ( post_content, 'oldURL', 'newURL' );

    That's all I ever do. Obviously you backup the DB first, but it's yet to fail me :)

  7. ctlockey
    Member
    Posted 3 years ago #

    Awesome. I'll give this a try and abandon my quest to reinvent the wheel.

Topic Closed

This topic has been closed to new replies.

About this Topic