Forum Replies Created

Viewing 4 replies - 1 through 4 (of 4 total)
  • I found this thread when I was looking to do the exact same thing.

    After some digging, I finally figured it out.

    1. Navigate to the URL tab under the custom content type you’d like to customize.
    2. Uncheck “Rewrite with Permalink Front”
    3. Permalink Action: Custom
    4. Rewrite Slug: “/”

    That’s it! The custom content type posts should default to {root}/%post-name%/

    I hope this helps!

    [IMPORTANT EDIT!]

    While this resulted in the URL structure desired for the custom content types, it effectively broke all of the regular page / post URL’s for the rest of the site. So please use this fix with caution. I’m going to continue searching for a universal fix.

    I temporarily fixed my problem by commenting out line 10 in class-frontend.php:

    remove_action( 'wp_head', 'rel_canonical' );

    But it will not fix once I upgrade the plugin. It would be nice to have some options as to when to use the canonical URL or disable it altogether.

    I would also like to be able to disable the canonical URL… the Yoast SEO plugin is creating a canonical non-friendl URL for a WP Custom Content Type and is screwing up the indexing for the search engines. Any ideas??

    Thread Starter nexusmedia

    (@nexusmedia)

    Not really, but I created a bit of a hack to achieve what I was trying to accomplish:

    So wherever I wanted the customize the page title, I would set a global variable containing the required title and then call get_header():

    global $title;
    $title = 'My Custom Title';
    get_header(); ?>

    And then the header.php page looks like this:

    <? global $title; ?>
    <? if ($title): ?>
    <title><?=$title?></title>
    <? else: ?>
    <title>
    <? wp_title('');?>
    </title>
    <? endif; ?>

    This could be shorthanded with a ternary syntax:

    <? global $title; ?>
    <? ($title) ? $title : wp_title('') ;?>

    So not the cleanest solution, but it got the job done.

Viewing 4 replies - 1 through 4 (of 4 total)