WordPress.org

Ready to get started?Download WordPress

Forums

Really Simple CAPTCHA
Site URL Not Proper inside img SRC (4 posts)

  1. Evan Herman
    Member
    Posted 1 year ago #

    have installed the plugin and have all the files in the right locations, all the right write/read/execute permissions set...but when I load my site I get a blank image as if the image was not found in the directory.

    I right click and check the inspector for the image url which it is trying to direct to. Well it is printing 3/4 of my URL and not printing the rest, so therefor it is giving me a 404 error.

    For example, my URL is

    http://my.website.staging.wpengine.com

    but this plugin is returning the URL http://my.website.staging.com

    and therefore checking the wrong directory all together on getting the images for the captcha. How can I change the URL or hardcode it in so its the right one??? I've been reading through the code for an hour and can not pin point where it is. I thought it was $prefix, but no its not. Thanks, any ones help would be much appreciated.

    p.s If I go in to the inspector and add in wpengine.com in to the SRC it works, so I know 100% it is the URL

    edit: I have now checked get_site_url as well as home_url and they are both properly set. Why is your plugin omitting the .wpengine from the images SRC path????

    http://wordpress.org/extend/plugins/really-simple-captcha/

  2. Evan Herman
    Member
    Posted 1 year ago #

    Still can't seem to figure this one out. It's just completely omitting parts of my URL.

    Any help would be appreciated

  3. Evan Herman
    Member
    Posted 1 year ago #

    Where is the url even being generated? I know the captchac and captchar create the image and the input box, but I can't find that cocde any where at all.

  4. Evan Herman
    Member
    Posted 1 year ago #

    After tons of searching and picking through files I was able to pin point the offending line.

    I doubt anyone will have the same or similar problem, but I will add the resolution here in case. (little background - I am a web developer at a company working on a pre-existing website. Inside the functions.php file of my theme I was able to find a line of code that removed the small segment from the URL resulting in an incomplete path to the captcha images.)

    The offending line:

    function remove_sites_from_upload_dir($upload_dir) {
    
    	foreach ( $upload_dir as $key => $value ) {
           // $value = str_replace( '.wpengine', '', $value ); -- this line removed .wpengine. from inside the URL and caused captcha to display broken image links on the contact page //
    		$upload_dir[$key] = str_replace('/sites/2', '', $value);
    	}
    
    	return $upload_dir;
    }
    add_filter('upload_dir', 'remove_sites_from_upload_dir', 10, 1);

    commenting out that single line fixed the problems for me. Good luck to any one having difficulties.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic