Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author kr4ft3r

    (@kr4ft3r)

    Hi, yes, this is the default way things work with WPCHTMLP.

    The WordPress default permalink domain.com/html-pages/mypage doesn’t even really work, only the domain.com/mypage (what you entered in the custom permalink field above the page code) actually works and will output the custom page.

    A major update of the plugin will be published in a few days that will clear this confusion and will be overwriting default WordPress permalink as seen in the edit page screen.

    Thread Starter redsvpo

    (@redsvpo)

    Oh I see. Thanks for the quick reply!

    I used the custom permalink first but it comes with the problem that the search feature on the websites routes to a 404 since that links to the html-pages/page.html. Will this be fixed in the update, or do you have an idea for a fix?

    Thread Starter redsvpo

    (@redsvpo)

    Worth noting that I have good skills in HTML and CSS, but I’m new to PHP and WP.

    Plugin Author kr4ft3r

    (@kr4ft3r)

    Yes you can add a few lines to the plugin file to overwrite default permalinks sitewide.
    Since I don’t want to post untested code here, and I have to do something else first, I will post a solution in couple hours.

    Plugin Author kr4ft3r

    (@kr4ft3r)

    This should work, add somewhere between other functions in /wp-content/plugins/wp-custom-html-pages/wp-custom-html-pages.php

    
    function WPCHTMLP_post_type_link($post_url, $post) {
    		if ( 'wpchtmlp_page' === get_post_type( $post->ID ) ) {
    			$page_meta_box = get_post_meta( $post->ID, 'WPCHTMLP_page_meta_box', true );
    			if(isset($page_meta_box ['html_permalink']))
    				return get_site_url()."/".$page_meta_box ['html_permalink'];
    		}
    		return $post_url;
    }
    add_filter( 'post_type_link', 'WPCHTMLP_post_type_link', 10, 2 );
    

    It will add filter to permalinks, where if post type is custom HTML page and it has custom permalink setup it will change default permalink to website.com/custom-permalink.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘How can i change the permalink category name’ is closed to new replies.