Version 3.4 now requires explicit post parameter
-
If you use a simple post id in a link e.g. https://www.example.com/1234, there’s a subtle change in 3.4 that will take you to the 404 page.
You’ll have to change the link to become:
www.example.com/?p=1234
Why would anybody want to use such a link? I’ve seen it very commonly quoted as part of a solution to add a dropdown list of attached images for a post.
<?php $args = array( 'numberposts' => -1, 'orderby' => 'menu_order', 'order' => 'ASC', 'post_type' => 'attachment', 'post_parent' => $post->ID, 'post_mime_type' => 'image' ); $image = get_posts($args); if($image) { ?> <select name="ar-images" style="width:100%;" onchange="window.location='<?php echo home_url("/?p="); ?>'+this.value;"> <option value="" <?php selected($custom["ar-images"][0], ""); ?>>View images</option> <?php foreach($image as $key => $data) : ?> <option value="<?php echo $data->ID; ?>" <?php selected($custom["ar-images"][0], $data->ID); ?>><?php echo basename ( get_attached_file( $data->ID ) ); ?></option> <?php endforeach; ?> </select> <?php } ?>
The original code has
home_url("/")
which now has to behome_url("/?p=")
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Version 3.4 now requires explicit post parameter’ is closed to new replies.