I want to be able to insert <span class="someClass"></span> inside wordpress the_content(); is there a way to do that ? so far i have been able to to target the first paragraph through preg_replace and add my class there but i also need a span tag a few words into the_content

  • You can use a custom pattern like "#Replace#" and set it in content and then you can use preg_replace for this so it will replace where you want to add that span tag. – Bhupen Dec 18 '19 at 7:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.