Hey guys,
So here is my problem, I have a custom post and I want to allow the user to specify the slug of the custom post as well as the taxonomy from the Option Tree dashboard so here is what I did : http://snippi.com/s/l59xl31
Unfortunately, it give me this error :
WARNING: wp-includes/functions.php:928 – Cannot modify header information – headers already sent by (output started at /Users/kailoon/Sites/wp35/wp-content/themes/MissionWP/includes/cpt-causes.php:4)
I’m pretty sure it’s simple but I can’t find how to fix this.
Can someone help?
Thanks!
1. uft-8 without BOM
2. no blank lines before <?php
3. remove all unnecessary white space below the code
4. do not use ?> at the end of code
EDIT: Just checked my CPT snippet, it looks EXACTLY the same.
Even this line:
'description' => 'Easily lets you create some beautiful portfolios.',

dekciw said
1. uft-8 without BOM2. no blank lines before <?php
3. remove all unnecessary white space below the code
4. do not use ?> at the end of code
EDIT: Just checked my CPT snippet, it looks EXACTLY the same.Even this line:
'description' => 'Easily lets you create some beautiful portfolios.',![]()
OMG where have you find it? Mine come from my friend : OTOTW

Actually, don’t think that I’m accusing you of code stealing or something like that – I do not actually care if someone uses my snippets, etc. I’ve just said it as a fun fact
You can check my cpt-portfolio.php here -> http://snippi.com/s/g9fwjch – and it works OK. So you’d better check for the stuff I’ve mentioned in my previous post.
Btw, I remember typing those descriptions myself. And never bought any OTOTW items 
I suggest use apply_filters for dynamic variable like this,
line 29
'rewrite' => array( 'slug' => apply_filters('custom_causes_post', 'causes') ),
line 58
'rewrite' => array( 'slug' =>apply_filters('custom_causes_tax', 'item-type') )
and in your functions.php,
add_filter('custom_causes_post', 'danny_causes_custom_slug');
function danny_causes_custom_slug(){
global $options;
$url_rewrite = $options['theme_causes_item_url'];
$slug = ( !$url_rewrite ) ? 'causes' : $url_rewrite;
return $slug;
}
add_filter('custom_causes_tax', 'danny_causes_custom_tax_slug');
function danny_causes_custom_tax_slug(){
global $options;
$url_rewrite = $options['theme_causes_item_type_url'];
$slug = ( !$url_rewrite ) ? 'causes' : $url_rewrite;
return $slug;
}
dekciw said
Actually, don’t think that I’m accusing you of code stealing or something like that – I do not actually care if someone uses my snippets, etc. I’ve just said it as a fun factYou can check my cpt-portfolio.php here -> http://snippi.com/s/g9fwjch – and it works OK. So you’d better check for the stuff I’ve mentioned in my previous post. Btw, I remember typing those descriptions myself. And never bought any OTOTW items
![]()
Doesn’t it come from Option Tree v2? 
@PrimeThemes : Thanks! Will try this 
One small suggestion is that you probably shouldn’t flush_rewrite_rules on every page load. This should be done only once when an option for rewrite slug is changed.
- Microlancer Beta Tester
- Author had a Free File of the Month
- Has been a member for 3-4 years
- Item was Featured
- Author was Featured
- Austria
- Exclusive Author
- Referred between 200 and 499 users
pogoking said
One small suggestion is that you probably shouldn’tflush_rewrite_ruleson every page load. This should be done only once when an option for rewrite slug is changed.
+1 please never call it on every page load 
Ok I won’t I won’t 
