How to allow different authors to use same post slug?

I ended up adding this code that makes the default post type hierarchical and populating the wp_posts.post_parent field with the author ID. The combination of these two has achieved the desired implementation of having the same slug across multiple authors. // Set post type “post” to be hierarchical $wp_post_types[‘post’]->hierarchical = 1; Source: https://stackoverflow.com/questions/10750931/wordpress-how-to-add-hierarchy-to-posts

Non-existent child page URLs redirects to the image attachment URL instead of throwing 404

If I understood you correctly you want to disable all attachment pages and redirect them to 404 page. Place this code in functions.php and try it again. add_action( ‘template_redirect’, ‘redirect_media_to_404’ ); function redirect_media_to_404() { if ( is_attachment() ) { global $wp_query; $wp_query->set_404(); status_header( 404 ); get_template_part( 404 ); exit(); } }

Add %post_id% to slug of custom post type and prevent the “unique slug” thing that WP does?

I don’t have much experience with coding rewrites, but could you just add $post->post_name into your return statement? return home_url(‘equipment/’ . $post->ID . ‘-‘ . $post->post_name ); There are a few other ways to change the permalinks that I have used that may also help you: The easiest way to change your permalink structure is … Read more

Change author base and slug in author link

i found out what i was doing wrong, i used this part like i mentioned add_filter( ‘request’, ‘wpse5742_request’ ); function wpse5742_request( $query_vars ) { if ( array_key_exists( ‘author_name’, $query_vars ) ) { global $wpdb; $author_id = $wpdb->get_var( $wpdb->prepare( “SELECT user_id FROM {$wpdb->usermeta} WHERE meta_key=’nickname’ AND meta_value = %s”, $query_vars[‘author_name’] ) ); if ( $author_id ) … Read more

I want to change the slugs of my terms dynamically

As far as I got you right, the following code is all you need to solve this. function my_function( $post_id ){ if ( ! wp_is_post_revision( $post_id ) ){ $post = get_post( $post_id ); $my_args = array( ‘ID’ => $post_id, ‘post_name’ => ” ); // unhook this function so it doesn’t loop infinitely remove_action( ‘save_post’, ‘my_function’ … Read more

List posts with slug title

If by “slug title” you mean a taxonomy (e.g. product category), then have a look at the code posted on the accepted answer on Display All Products by Category with WooCommerce It should give you an idea (or even the complete solution) how to get your posts listed.

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)