Site logo

Archived topic

Unexecuted PHP codes are being displayed on Shop sections & products

3 replies · Started by Nitin on February 9, 2020

Viewing posts 1–4 of 4

Unexecuted PHP codes are being displayed on Shop sections & products.

Here are some codes that are appearing at the front-end:

get_id() ) ) { $attachment_ids[0] = get_post_thumbnail_id( $product->get_id() ); $attachment = wp_get_attachment_image_src( $attachment_ids[0], 'full' ); ?> get_gallery_image_ids(); foreach( $product_image_ids as $product_image_id ) { $image_url = wp_get_attachment_url( $product_image_id, 'full' ); echo ''; } } // Closing div found in Close Summary Wrap element ?>

'name', 'order' => 'asc', 'hide_empty' => true, ); $product_categories = get_terms( 'product_cat', $cat_args ); if ( ! empty( $product_categories ) ) { echo '
'; foreach ( $product_categories as $key => $category ) { printf( '
%2$S
', get_term_link( $category ), $category->name ); } echo '
'; } ?>

Note: This is testing for my client but once it's solved I'll create the same site for my client so please let me know why the issue happened.

Hi there,

the Niche site uses a few Hook Elements - more info on each can be found in the Sites blog - The Shop post and The Single Product post.

I assume that your sites wp-config has define( 'DISALLOW_FILE_EDIT', true ); set.

Choices are:

1. Set DISALLOW_FILE_EDIT to false.
2. Allow PHP Execution in GP Hooks - see here for the PHP Snippet to allow that

https://docs.generatepress.com/article/generate_hooks_execute_php/

3. Remove those Hooked functions from the site ....

It was done using Sucuri. I reverted the hardening but there should have been a different way I guess.

As it can compromise with the security of the site. However, thank for the help!

Option 2 will limit the editing capability to just the Hook Element.
Which is less likely to be known about by a hacker that gains access to your admin.

This archived topic is closed to new replies.