im really new to wordpress so it's currently hard to decide which approaches are better.

I'm a developer and there are some wordpress principles im struggling with.

What is the best way to implement custom backend code? Par example calling an API and show the results on the page.

I red about different techniques like adding a shortcode, using hooks, edit child theme-files directly, there is also this REST-API from wordpress.

  1. Maybe someone can point out, some typicall use-cases or examples when to use which technique and which is giving the most freedom?

  2. What is when i use an Page-Builder like Elementor, then everything is stored in the database. How would i add some backend code here?

  3. Currently Im using the free version of woocommerce for making a multi-vendor marketplace. Therefore i need a frontend product upload. What is the best way to implemen this? Writing directly into the database or using the woocommerce api?

Concept of having some page-related stuff in files and others in database (which make versioning harder) is somehow against my intuition as a developer.

Thanks in advance

1 Answer 1


Regarding question #1:

It's difficult to answer because WordPress is flexible so there are different ways to do things (I know this is vague) and it depends on what your skills are (are you more skilled at React and JS or PHP? ), how much time you are willing to spend learning, and other circumstances, and like freedom for whom (the developer or the end user? Usually freedom for one comes at the cost of the other).

Customizing Backend code: this is generally recommended to be done with plugins.

Shortcodes (here's a great overview of shortcodes by wpshout) are used generally to input more complex content. If you are working with many co-workers and want to give them some flexibility on adding content like maps without manually copying and pasting html, css, php, and js, you could use shortcodes.

Note, that the block-editor (known as Gutenberg), is aimed to replace shortcodes and can do the same thing although the block-editor uses React and is a remarkable change from using php.

  • Thanks for your answer. So for adding a form to post some data into the database it is a good approach to use shortcode/block?
    – nitsuj1001
    Jan 18, 2020 at 16:57
  • @nitsuj1001 From my limited information, it is not a bad idea to use either of them. For forms, there are pre-built plugins like gravityforms or ninjaforms so you do not have to build from scratch.
    – Will
    Jan 19, 2020 at 3:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.