0

I have been developing a custom extension for my theme over the last few weeks.

This is my first time "developing" with Wordpress. All works fine and I am happy with the resulting functionality, albeit it needs some tidying.

My extension currently stores all data in an array in the user_meta table. When any page loads which uses the extension, all of these variables are pulled:

main-block.php

if (is_user_logged_in()) {

                $custom_meta = get_user_meta($userid, 'custom' . $postid, true);
                $custom1 = $custom_meta['custom1'];
                $custom2 = $custom_meta['custom2'];
                $custom3 = $custom_meta['custom3'];
                .....
                $custom8 = $custom_meta['custom8'];

Is there a way to greatly clean this up by storing all of these variables outside of main-block so I can just call them without defining them in here?

Or is this normal and OK?

Thanks.

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.