Hi Gaurav,
Thank you for querying in this forum.
According to your description, it seems that you want to add custom script on SharePoint old site, and you have also activated Server Publishing infrastructure, however, you still cannot see this option.
If my understanding is right, we have tested it on our side, we went to SharePoint classic site > click Edit page > Insert Webparts > Media and Content > Script Editor, as shown below:
So we’d suggest you go to click Edit page > Insert > Webparts > Media and Content to check if you can find webpart.
If not, We’d give you suggestions below and hope that will help you:
- You can go to SharePoint Online admin center with admin account > Settings > classic settings page > Custom Script > select Allow users to run custom script on personal sites and Allow users to run custom script on self-service createdsites.(Note: This may take up to****24 hours to reflect the changes. Sometimes it may take more than that and sometimes it may take 3/4 hours also.)
- If you have tried the suggestion above and you still cannot see this option, you can also refer to this article to use PowerShell to enable content editor or script editor web part in SharePoint Online.
For more details, you can refer to this article: Allow or prevent custom script How to enable script editor web part in SharePoint Online Office 365
Please do let us know if that works for you, we’ll be glad to provide further help.
Best Regards,
Sukie