Title: Beginner-problem with php code
Last modified: July 21, 2023

---

# Beginner-problem with php code

 *  [enekomendi](https://wordpress.org/support/users/enekomendi/)
 * (@enekomendi)
 * [2 years, 10 months ago](https://wordpress.org/support/topic/beginner-problem-with-php-code/)
 * Hello,
 * My php code is delimited by [insert_php] …..[/insert_php] and I and using php
   7.4.
 * i want to insert php code in my website.
 * but when I update my page with code like this:
 * $miObj->setParameter(“SSSS”);
 * wordpress replaces characters and inserts
 * $miObj**-&gt;**setParameter(“SSSS”);
 * and my code fails.
 * How can I correct it?
 * Best regards

Viewing 1 replies (of 1 total)

 *  [wavedeck](https://wordpress.org/support/users/wavedeck/)
 * (@wavedeck)
 * [2 years, 10 months ago](https://wordpress.org/support/topic/beginner-problem-with-php-code/#post-16913695)
 * Why do you want to run dynamic PHP code through a shortcode? This is a huge anti
   pattern and leads to all sorts of nasty problems (SQL Injections, XSS Attacks…)
 * the best way to achieve this is creating a custom plugin or using the functions.
   php file of your (child) theme to simply register a custom shortcode for every
   custom code you want to insert. It might not fulfill what you were trying to 
   do but this is a lot safer.
 * Btw.. WordPress does not sanitize the attributes or body of a shortcode on its
   own, it’s most likely the sanitization of the WYSIWYG editor you are using (be
   it Gutenberg, TinyMCE or a pagebuilder like Elementor)

Viewing 1 replies (of 1 total)

The topic ‘Beginner-problem with php code’ is closed to new replies.

## Tags

 * [php](https://wordpress.org/support/topic-tag/php/)

 * In: [Developing with WordPress](https://wordpress.org/support/forum/wp-advanced/)
 * 1 reply
 * 2 participants
 * Last reply from: [wavedeck](https://wordpress.org/support/users/wavedeck/)
 * Last activity: [2 years, 10 months ago](https://wordpress.org/support/topic/beginner-problem-with-php-code/#post-16913695)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
