How is a URL getting mapped to a page template

I have done something similar by adding a rewrite rule add_rewrite_rule( “users”, “index.php?fea_users”, ‘top’); add_filter( ‘query_vars’, array($this, ‘query_vars’) ); add_filter( ‘template_include’, array($this, ‘template_include’), 1, 1 ); function query_vars( $query_vars ) { $query_vars[] = “fea_users”; return $query_vars; } function template_include( $template ) { global $wp_query; if ( isset($wp_query->query[“fea_users”]) ) { // return any php file here … Read more

Why is there a # and other characters in URL for WordPress site?

Check your database,maybe you’re hacked. Here what must be searched: wp_options,this is the name the wordpress option,the second record is your blog_name. (If you’re new bie in porgraming and/or wordpress here the steps: 1.Go to cpanel(on your hosting): 2.Search for “phpMyAdmin”and select it 3. Must be find your wordpress database, if you’re lucky the name … Read more

append links with unique number string

you should probably create a CPT with hierarchical structure like pages and support for categories and tags if needed. Once you have it each story can be a “main” page and each update its child. You might need to decide how to generate RSS and email updates for it if it is required. Another alternative … Read more

Make assigning post to a specific category equivalent to assigning it to all categories

One way to deal with the problem is to use the redirect_canonical filter to cancel the redirect (that happens when the category that the post is assigned to doesn’t match the category slug in the requested post URL) for posts assigned to International (intl) category. /* * Related core file: wp-includes/canonical.php * * NOTE: If … Read more

WooCommerce product permalinks

Add a filter for post_type_link, and change its value in a callback function. Sample code, not tested: add_filter( ‘post_type_link’, ‘simple_woo_urls’, 10, 2 ); function simple_woo_urls( $url, $post ) { if ( ‘product’ === $post->post_type ) return home_url( $post->post_name ); return $url; }