Automatically changes special characters
-
Good day
I have a code snippet that is suppose to count the amount of posts of a specific user. Where the code checks that the user is logged in it keeps changing one of the special characters “>” to “>”.
Here is the code:
function total_post_count() { $current_user = wp_get_current_user(); if ( 0 == $current_user->ID ) { return; } else { $profile_id = um_profile_id(); $count = count_user_posts( $profile_id ); echo "<p class='post_count'>" . $count . "</p>"; } } add_shortcode( 'total_post_c', 'total_post_count' );
The “>” in line 3 is the one that keeps changing. The strange part is that the snippet works for a few days and then suddenly the snippet automatically deactivates due to a syntax error and I find that the “>” was changed to “>”. When this happens all the other snippets also stop working although they are still activated. Once I change the “>” back to “>” then I can activate this snippet and all the other snippets start working again.
Why would this keep happing at random intervals, sometimes after a few days, and how do I go about preventing this change in the future?
- The topic ‘Automatically changes special characters’ is closed to new replies.