Accidentally Changed WordPress Url

If you’re on a local install, it’s fairly trivial to fix this. Just use phpMyAdmin to reset home_url and/or site_url in the wp_options table in the database. Switching between two localhost installs is also fairly straight-forward: just don’t actually use “localhost” for anything. Instead, set up a unique domain in your system’s hosts file for … Read more

How to remove parent section in an attachment URL in wordpress?

You can add a filter to the function that gets attachment links to force that format: function wpa60888_attachment_link( $link, $id ){ return home_url() . ‘/?attachment_id=’ . $id; } add_filter( ‘attachment_link’, ‘wpa60888_attachment_link’, 10, 2 ); Calls to get_attachment_link will have this filter applied to the output.

Choose options via url

I think this Custom Field Template plugin will help you. Plugin site. Don’t worry about Chinese screenshots. If you set at least one Custom Field Template for one category, when creating post and check that category additional options will appear.

Rename page URL

I have tried some add_rewrite_rule magic and query variables and it worked. Thanks for the help everyone. If in case anyone want to refer the answer: add_filter( ‘query_vars’, ‘wpse26388_query_vars’ ); function wpse26388_query_vars( $query_vars ){ $query_vars[] = ‘custom_gallery_id’; return $query_vars; } add_rewrite_rule( ‘topic/([^/]+)/([^/]+)/gallery/([0-9]+)/?$’, ‘index.php?pagename=gallery&custom_gallery_id=$matches[3]’, ‘top’ ); I was able to solve my problem with this.

create gallery page for specific post id

If you want to get all images attached to a single post then you can use this if ( $images = get_posts(array( ‘post_parent’ => $post->ID, ‘post_type’ => ‘attachment’, ‘numberposts’ => -1, ‘post_mime_type’ => ‘image’,))) { foreach( $images as $image ) { $attachmenturl=wp_get_attachment_url($image->ID); $attachmentimage=wp_get_attachment_image_src( $image->ID, full ); $imageDescription = apply_filters( ‘the_description’ , $image->post_content ); $imageTitle = … Read more