WordPress.org

Ready to get started?Download WordPress

Forums

Twitter Friendly Links
[resolved] 404 error with some content (4 posts)

  1. connetport
    Member
    Posted 3 years ago #

    hi,

    I've done a page witch can be found here : http://www.connetport.com/8or

    I use WPML and so I've also made french version and spanish version

    the french url : http://www.connetport.com/8ou
    the spanish url : http://www.connetport.com/8p1

    As you can see the english and french url made via your plugin work well.

    However it does not work on the spanish content (gives a 404 error)
    In fact any spanish content url made via your plugin does not work. Only english work and french works sometimes.

    Can you help me on that matter ?

  2. connetport
    Member
    Posted 3 years ago #

    It's getting worse.

    Now the the french url : http://www.connetport.com/8ou does not work.

    Please help !

  3. connetport
    Member
    Posted 3 years ago #

    bump.

  4. connetport
    Member
    Posted 3 years ago #

    found the "bug" .......
    It is due to wpml .... in WP 3.0.3 with up to date wpml the thing is that the wp_query does not work at all.

    wpml wants that we use icl_object_id however, in this case, we don't know the exact type of post so it's useless.

    I have made a quick / dirty fix in the plugin

    In the template_redirect function I've made the following changes :

    Original

    if (is_numeric($post_id))
    				{
    
    					global $wp_query;
    
    					$posts = new WP_Query("p=$post_id&post_type=any");
    					if ($posts->have_posts())
    					{
    						$posts->the_post();
    						$post = $posts->post;
    
    						if (!$this->settings["posts_enabled"] && $post->post_type == "post") return;
    						if (!$this->settings["pages_enabled"] && $post->post_type == "page") return;
    						if (!$this->settings["attachments_enabled"] && $post->post_type == "attachment") return;
    
    						status_header(200);
    						wp_redirect(get_permalink().$ga_tracking, $redirect);
    
    						exit();
    					}
    				}

    Modified

    if (is_numeric($post_id))
    				{
    
    					global $wp_query;
    
    					$posts = new WP_Query("p=$post_id&post_type=any");
    					$wpmlfix = get_permalink($post_id);
    
    					if ($posts->have_posts() | (isset($wpmlfix) && trim($wpmlfix)!=''))
    					{
    						$posts->the_post();
    						$post = $posts->post;
    
    						if (!$this->settings["posts_enabled"] && $post->post_type == "post") return;
    						if (!$this->settings["pages_enabled"] && $post->post_type == "page") return;
    						if (!$this->settings["attachments_enabled"] && $post->post_type == "attachment") return;
    
    						status_header(200);
    
    						wp_redirect($wpmlfix, $redirect);
    						exit();
    					}
    				}

    normaly this change does not have no more impact than correct the wpml + twitter friendly links bug.
    hopes that helps someone.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic