Forum Replies Created
-
Thanks! A dynamic filter name.. no wonder that i didn’t found it 😉
Sry, i would have edit my previous post, but there’s no option 🙂
I have an addendum. If i save the post, before i publish it, the meta_value is stored in the database and is also present in the activity item.
But if i publish it directly, the meta_value is obviously not saved, when the activity is created, so my theory from above seems right.
Maybe it’s important to mention, that i save the posts for this CPT from the Frontend. First i call the function
wp_insert_post
and immediately afterwards i callupdate_post_meta
to add or update the corresponding meta values.So.. i have test it with the ID of an already existing post and the meta_value show up in the newly created activity.
$existing_post_id = 12345; $cpt['content'] = get_post_meta( $existing_post_id, 'guide_description', true );
Then i have tried it again with the dynamically generated ID and the meta_value doesn’t show up. If i put this ID also right behind the get_post_meta function, only the ID will be visible, but not the meta_value.
$cpt['content'] = get_post_meta( $cpt['secondary_item_id'], 'guide_description', true ) . $cpt['secondary_item_id'];
Any Ideas? I don’t know how to fix this..
I cannot actually test it, but i guess it’s eventually a timing problem. Maybe the post meta data isn’t already stored into the database, when the activity is added.
Something like this:
1. Post is stored into the database
2. bp_activity_add() creates the activity
3. post_meta is stored into the databaseThe variable
$cpt['secondary_item_id']
is holding the correct post_id. I have checked it. But maybe the post_meta isn’t there, whenbp_activity_add()
is called.I will test it later with an already existing post.
I have also tried to set the filter priority to a higher value, so it’ll be called later, but that didn’t work too. :/
Thx for your answer. I didn’t want to be rude, but it was a bit frustrating for me 😉
Reorganisation of the codex sounds really good. If i can contribute in any way, then i’ll be glad to do.
Have found the solution by myself. If anyone interested, here’s the code i have added to my bp-custom.php. i think it works as well in the themes functions.php.
function remove_wpautop_from_buddypress() { if( bp_current_component() ) { remove_filter( 'the_content', 'wpautop', 99 ); } } add_action('bp_init', 'remove_wpautop_from_buddypress');
bp_current_component() is true, if you be on a buddypress page, so wpautop is only disabled there.
But i still wonder, why it’s necessary to do something like that. 😉