return does not work but echo does

[ad_1]

Hi @andersonkoh,

That seems to be working as intended. The code in that snippet will be executed “as is” in the location you choose. Return will not output anything but echo will. Usually, you would use return at the end of a function, for example, and then echo the value returned by the function if you want it to output in the frontend.

Adding it in the Theme File Editor depends where you add it, if you are adding the code inside a function that then gets called and echoed in a template file, it will work.

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer