• Resolved andrea.cinque

    (@andreacinque)


    Hello!
    I’m facing this problem from hours and I need some help in order to change my edd products url using child theme.

    If I use the main theme indeed, it works fine. With child theme it doesn’t.

    I’m trying to edit the EDD slug using using constant define('EDD_SLUG', 'mockups'); but it doesn’t work.

    This is what my functions.php looks like:

    <?php
    function set_download_labels($labels) {
      $labels = array(
        'name' => _x('Mockups', 'post type general name', 'mayosis'),
        'singular_name' => _x('Mockup', 'post type singular name', 'mayosis'),
        'add_new' => __('Add New', 'mayosis'),
        'add_new_item' => __('Add New Mockup', 'mayosis'),
        'edit_item' => __('Edit Mockup', 'mayosis'),
        'new_item' => __('New Mockup', 'mayosis'),
        'all_items' => __('All Products', 'mayosis'),
        'view_item' => __('View Mockup', 'mayosis'),
        'search_items' => __('Search Mockups', 'mayosis'),
        'not_found' =>  __('No Mockups found', 'mayosis'),
        'not_found_in_trash' => __('No Mockups found in Trash', 'mayosis'),
        'parent_item_colon' => '',
        'menu_name' => __('Mockups', 'mayosis'),
        'featured_image'        => __( '%1$s Image', 'easy-digital-downloads' ),
        'set_featured_image'    => __( 'Set %1$s Image', 'easy-digital-downloads' ),
        'remove_featured_image' => __( 'Remove %1$s Image', 'easy-digital-downloads' ),
        'use_featured_image'    => __( 'Use as %1$s Image', 'easy-digital-downloads' ),
      );
      return $labels;
    }
    add_filter('edd_download_labels', 'set_download_labels');
    
    define('EDD_SLUG', 'mockups');

    After this, I’ve saved again my permalinks but nothing has changed.

    Could you please help me find out what I am doing wrong?

    Thanks for your support,
    Andrea

Viewing 1 replies (of 1 total)
  • Hi @andreacinque

    There are two ways to achieve this.

    1) Please add this define variable in WordPress config.php file before this line
    /* That’s all, stop editing! Happy publishing. */

    define('EDD_SLUG', 'mockups');

    2) You can add below code in your child theme functions.php file and save it. Please update your permalink structure also.

    function edd_modify_download_post_type_args( $download_args ) {
    
    	if( ! empty( $download_args['rewrite']['slug'] ) ) {
    		$download_args['rewrite']['slug'] = 'mockup';
    	}
    
    	return $download_args;
    }
    add_filter( 'edd_download_post_type_args', 'edd_modify_download_post_type_args' );

    Please try any of the above methods. I hope it works for you.

Viewing 1 replies (of 1 total)
  • The topic ‘Slug replacement doesn’t work with child theme’ is closed to new replies.